FriendsOfCake/crud — pull request #89 by Phally (2013-08-26 09:43:22+00:00)
Title: Adds listener to make API output consistent with other popular APIs.

**Why?**

Currently the API output is pretty similar to CakePHP array. This isn't a problem when it's a private API and you are the only one using it. However to the outside world it looks a bit weird and is unpredictable compared to
APIs from Twitter, Google, GitHub, etc.

**What does it do?**

This listener does three things:

- Nests data of associated data properly under the primary record.
- Converts camel cased model names to singular/plural keys.
- Casts values from strings to their proper datatypes.

There are options for each of these features which you can disable at any time. This means you can only use it for the casts or the nesting as well. You can leave the keys intact for example.

**Example**

```
GET https://api.example.com/users.json
```

Normal output:

```JSON
{
"success": true,
"data": [{
"User": {
"id": "15",
"username": "Phally"
},
"Profile": {
"id": "51",
"twitter": "@Phally"
}
}]
}
```

New output:

```JSON
{
"success": true,
"data": [{
"id": 15,
"username": "Phally",
"profile": {
"id": 51,
"twitter": "@Phally"
}
}]
}
```