Consider the following code:
{
"post":{
"id":1,
"title":"Killing Koopas",
"author":"Super Mario",
"categories":[
12,
41
],
"translations":{
"en":{
"title":"Something",
"content":"A long text"
},
"es":{
"title":"Algo",
"content":"un texto largo"
}
}
},
"categories":[
{
"id":12,
"translations":{
"en":{
"title":"News",
"description":"a description"
},
"es":{
"title":"Noticias",
"description":"una descripción"
}
}
},
{
"id":41,
"translations":{
"en":{
"title":"Sport",
"description":"another description"
},
"es":{
"title":"Sport",
"description":"otra descripción"
}
}
}
]
}
As you can see both "post" and "categories" models have a "translations" field with different sub-fields. This is a simplified version of my real model. How would you map a JSON structure like this one to Ember Data?
Aucun commentaire:
Enregistrer un commentaire