# ERROR SyntaxError: Unexpected token { in JSON at position 89

**URL:** <https://forum.ionicframework.com/t/error-syntaxerror-unexpected-token-in-json-at-position-89/149207>\
**Category:** ionic-v3\
**Created:** [December 2, 2018, 5:26am UTC](https://forum.ionicframework.com/t/error-syntaxerror-unexpected-token-in-json-at-position-89/149207 "2018-12-02T05:26:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![damilare1](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@damilare1](https://forum.ionicframework.com/u/damilare1)\
**Post date:** [December 2, 2018, 5:26am UTC](https://forum.ionicframework.com/t/error-syntaxerror-unexpected-token-in-json-at-position-89/149207/1 "2018-12-02T05:26:16Z")

</div>

Hi, im getting this error SyntaxError: Unexpected token { in JSON at position 89 at JSON.parse on this function  
load(){

```
  var url = 'http://localhost:8080/projects/ionic/fetch.php';
 this.datas = this.http.get(url);
 this.datas.map(res => res.json())
 .subscribe(data => {
    
    this.results = data.results;
    console.log(this.results);
    //console.log(JSON.stringify(data));
 }); 

```

}

PHP code

\<?php header("Access-Control-Allow-Origin: \*"); $data = json\_decode(file\_get\_contents("php://input")); //$username = $data-\>username; //$password = $data-\>pass; require 'dbconnect.php'; $sql = "SELECT \* FROM users"; $query = $con-\>query($sql); $response = array(); if($query-\>num\_rows \> 0){ while($row = $query-\>fetch\_assoc()){ $response = array( "id" =\> $row['id'], "username" =\> $row['username'], "email" =\> $row['email'], "telephone" =\> $row['telephone'] ); echo json\_encode(array("data" =\> $response)); } }else{ echo json\_encode(array("data" =\> '', "message" =\> "error")); } $con-\>close(); ?\>

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:08pm UTC](https://forum.ionicframework.com/t/error-syntaxerror-unexpected-token-in-json-at-position-89/149207/2 "2021-07-19T21:08:06Z")

</div>

Closed on July 19, 2021, 9:08pm UTC


