I receive a JSON from our API that has the following format
[
{
"id": 45,
"name": "Pasta",
"_order": 0,
"is_hidden": null,
"is_list": false
},
{
"id": 46,
"name": "Salads",
"_order": 1,
"is_hidden": null,
"is_list": false
},
{
"id": 47,
"name": "Dessert",
"_order": 2,
"is_hidden": null,
"is_list": false
}
];
I see that it has invalid format for standard RESTAdapter and I need to put the name of the model first. In my example it should probably be like:
{
"category":
[
{
"id": 45,
"name": "Pasta",
"_order": 0,
"is_hidden": null,
"is_list": false
},
{
"id": 46,
"name": "Salads",
"_order": 1,
"is_hidden": null,
"is_list": false
},
{
"id": 47,
"name": "Dessert",
"_order": 2,
"is_hidden": null,
"is_list": false
}
]
}
So how to make it look this way in my adapter? It seems like I should use DS.RESTSerializer
, but I can't figure out which method I should override...