Converting REST response

I need to convert the JSON response from the server to fit with ember… where is the best place to do that?

The response from the server, for GET /books resource, looks like this:

{
  "d" : {
    "results": [
      { 
        "Id": 1, 
        "Title": "The Title",
        "Path": "/Books"
      }, 
      { 
        "Id": 2, 
        "Title": "Another Title",
        "Path": "/Books"
      },
    ]
  }
}

I need to take the results array and end up with a payload that looks something like this:

"books": [
  { 
    "Id": 1, 
    "Title": "The Title"
  }, 
  { 
    "Id": 2, 
    "Title": "Another Title"
  },
]

Any help much appreciated…

Create a custom serializer for this model that extends from DS.RESTSerializer. Then you can do that in the normalizeResponse() method. I have an example of something pretty similar to your situation in one of my blog posts: 404 Not Found

Thanks… just the advice I was looking for… I will read through your blog post and see how I get on.