SyntaxError: Unexpected token o at Object.parse (native) AngularJS SyntaxError: Unexpected token o at Object.parse (native) AngularJS angularjs angularjs

SyntaxError: Unexpected token o at Object.parse (native) AngularJS


I think data returned is already in JSON, no need of JSON.parse(), unless it in string format.

$scope.products= data;


Why you using JSON.parse in two times?

 var myjson = JSON.parse(data);  $scope.products = JSON.parse(myjson);

You have already parse the data object,So then why you parsing another one time?

also i think your data is return Json result, so you don't need to parse the object

just use this

$scope.products = data;


Your variable myjson is already a valid JavaScript Object. You do not have to use JSON.parse on it.