@bcgreen24 wrote:
Good day, all you wonder ember.js people!
I am trying to consume an API that is returning JSON in a non-standard format. The response looks like thisL
{ "Search":[ {"Title":"something", "Year":2000",...}, {"Title":"something else", "Year":1995",...}, {"Title":"another thing", "Year":1985",...}, ], "total results":"221","Response":"True" }
And of course I’m seeing this error, since there is no ‘type’ key:
Error while processing route: movies Cannot read property 'type' of undefined TypeError: Cannot read property 'type' of undefined
My model is name ‘movie’. I’m trying to figure out how to inject ‘type’:‘movie’ in the response, wrap each item with an ‘attributes’ key, or otherwise do what I need to do to normalize the response, but I’m not quite understanding the docs I’ve been reading. And don’t I also need to add a ‘data’ key at the very beginning of the payload (replace ‘Search’ with ‘Data’)?
Also-- I’m using a JSONAPIAdapter-- should I use a ‘RESTAdapter’ since this is a non-standard format?
Thanks! Bryan
Posts: 1
Participants: 1