On CanJS.com, it says not to return an array from a JSON service by itself. Instead, it should look like this:
{
"data": [
{"id":1, "description":"Do the dishes."},
{"id":2, "description":"Mow the lawn."},
{"id":3, "description":"Finish the laundry."}
]
}
Why is this necessary, and does it only apply to Arrays or does it apply to all Objects? For instance, should a single object response look like this?
{
data: {"id": 5, "createdAt": 2234234329}
}
Or if there's only one data item, is the data
field no longer necessary? For example:
{
"id": 5, "createdAt": 2234234329
}