ERROR SyntaxError: Unexpected token { in JSON at position 89


#1

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(); ?>