mardi 31 octobre 2017

Ember Unexpected Token (In JSON at position 0)

Error:

Error while processing route: about Unexpected token < in JSON at 
position 0 SyntaxError: Unexpected token < in JSON at position 0

I have a feeling I know what's causing this error, but I can't seem to figure out how to serialize the data. Here is my data when I hit my API in postman:

[
  {
    "site_id": 1,
    "site_name": "example.com",
    "view_id": 136791757,
    "project_manager_id": 2,
    "created_at": "2017-10-19 02:52:15",
    "updated_at": "2017-10-19 02:52:15"
 },
 {
   "site_id": 2,
   "site_name": "example2.com",
   "view_id": 136903606,
   "project_manager_id": null,
   "created_at": "2017-10-19 04:12:58",
   "updated_at": "2017-10-19 04:12:58"
 }
]

Is the error I'm getting related to the fact that this response is in array form?? Do I need to serialize? If so, how?!

I did some Googling and this seems to be a somewhat common error, but could not find any Ember specific answers, so this could be helpful for others.

Thanks!!




Aucun commentaire:

Enregistrer un commentaire