Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Converting REST response

$
0
0

@LozJackson wrote:

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..

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles