# Unhandled Rejection (SyntaxError): Unexpected token \< in JSON at position 0

**URL:** https://discourse.getcockpit.com/t/unhandled-rejection-syntaxerror-unexpected-token-in-json-at-position-0/412
**Category:** Support
**Created:** [November 20, 2018, 11:46am UTC](https://discourse.getcockpit.com/t/unhandled-rejection-syntaxerror-unexpected-token-in-json-at-position-0/412 "2018-11-20T11:46:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Namwanza](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Namwanza](https://discourse.getcockpit.com/u/Namwanza)
#### Post date: [November 20, 2018, 11:46am UTC](https://discourse.getcockpit.com/t/unhandled-rejection-syntaxerror-unexpected-token-in-json-at-position-0/412/1 "2018-11-20T11:46:15Z")

</div>

Hello Cockpit Community ;

Any one to help me why am getting this error when i try to read my collections from cockpit.

Here is an error that am getting in the browser when i run the app.

**Unhandled Rejection (SyntaxError): Unexpected token \< in JSON at position 0**

Here is my react component where am reading my collection as JSON

```
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

class App extends Component {

  constructor() {
    super();
      this.state={items:[]};
  }

  componentDidMount(){
    fetch('/api/collections/get/posts?token=6d6126a5613634a710aee0ddbadbe1')
    .then(res => res.json())
    .then(res => console.log(res));
  }

  render() {
  return(
    <div>
        {this.state.items.length ?
          this.state.items.map(item=><div key={item.id}>{item.body}</div>) 
          : <li>Loading...</li>
        }
    </div>
 )
}
}

export default App;
```

---

<div class="post-metadata">

### Author: ![Namwanza](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Namwanza](https://discourse.getcockpit.com/u/Namwanza)
#### Post date: [November 20, 2018, 1:57pm UTC](https://discourse.getcockpit.com/t/unhandled-rejection-syntaxerror-unexpected-token-in-json-at-position-0/412/2 "2018-11-20T13:57:16Z")

</div>

Well; I found out the issue. The Issue was with the url that i was fetching data from was wrong as it was lacking a host ip address eg [https://10.8.0.2/xxx/yyy?token=888d](https://10.8.0.2/xxx/yyy?token=888d)… so i updated the url and it worked fine.

Thanks!
