Format associative JSON to work with Knockout.js

I recently started creating a RESTful API in CakePHP to work with a Knockout.js frontend. While Knockout.js is a lot of fun, it does expect your JSON to be in a certain format. Take the following response from a simple find action: "Projects": [ { "Project": { "id": "151", "title": "Een ander project", "slug": "een-ander-project", "description": "dsfdsfs", "tasks_count": "2", "tasks_backlog": "2", "tasks_open": "0", "tasks_closed": "0", "duedate": "2012-04-09", "created": "2012-04-09 13:52:19", "modified": "2012-04-09 13:52:19" }, "Task": [ ] }, { "Project": { "id": "152", "title": "Een ander project", "slug": "een-ander-project-1", "description": "dsfdsfs", "tasks_count": null, "tasks_backlog": null, "tasks_open": null, "tasks_closed": null, "duedate": "2012-04-09", "created": "2012-04-09 13:55:30", "modified": "2012-04-09 13:55:30" }, "Task": [ ] }, This is fine to work with in your typical View, but Knockout rather has a nested format, and doesn’t like the leading Project nodes.