Although the documentation claims that it is JSON API compatible http://ember-graph.com/api/JSONSerializer.html#index, I am having trouble to deserialize a payload
{
"links":{
"self":"http://localhost:3001/api/accounts/1?_=1460310632001"
},
"data":{
"type":"accounts",
"relationships":{
"roles":{
"links":{
"related":"http://localhost:3001/api/accounts/1/roles"
}
},
"company":{
"links":{
"related":"http://localhost:3001/api/accounts/1/company"
}
}
},
"id":"1",
"attributes":{
"is-admin":true,
"username":"admin",
},
"links":{
"self":"http://localhost:3001/api/accounts/1"
}
}
}
I am getting the following error
Error: Cannot find model class with typeKey: links
If I remove the links in the deserializer
export default EmberGraph.JSONSerializer.extend({
deserialize: function (payload, options) {
console.log(payload);
delete payload.links;
return payload;
}
});
Then it complains about the data property
Error: Cannot find model class with typeKey: data
They are both valid parts of the JSON API specification. http://jsonapi.org/format/#document-top-level
PS.: There is always a parameter added by EG to the end of the requests:
_=1460310632001
Where does it come from, and why?
Although the documentation claims that it is JSON API compatible http://ember-graph.com/api/JSONSerializer.html#index, I am having trouble to deserialize a payload
{ "links":{ "self":"http://localhost:3001/api/accounts/1?_=1460310632001" }, "data":{ "type":"accounts", "relationships":{ "roles":{ "links":{ "related":"http://localhost:3001/api/accounts/1/roles" } }, "company":{ "links":{ "related":"http://localhost:3001/api/accounts/1/company" } } }, "id":"1", "attributes":{ "is-admin":true, "username":"admin", }, "links":{ "self":"http://localhost:3001/api/accounts/1" } } }I am getting the following error
If I remove the
linksin the deserializerThen it complains about the
datapropertyThey are both valid parts of the JSON API specification. http://jsonapi.org/format/#document-top-level
PS.: There is always a parameter added by EG to the end of the requests:
Where does it come from, and why?