jsonapi-serializer
jsonapi-serializer copied to clipboard
Deserialize How get attributes of relationsship
i have
"included": [
{
"type": "author",
"id": "321321",
"attributes": {
"surname": "Nick",
"name": "Joesn"
},
new JSONAPIDeserializer({
author: {
valueForRelationship: function (relationship) {
return {
id: relationship.id,
// There i have only id = 321321
// How get "surname" and "name"
};
}
}
})
i found
valueForRelationship: function (relationship, included) { return { id: relationship.id, name: included.name }; }
please, add it to doc, because it very important