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

JSON Serialization

$
0
0

@t3ndai wrote:

Just started hacking or i.e. experimental learning Ember. I have an API that I made used by other clients that gives me a response in the following format.

[ { “pay”: 90000 }, { “pay”: 75000 }, { “pay”: 90000 } ]

From what I understand, I’m supposed to normalize the JSON, saw this https://stackoverflow.com/questions/20410016/transform-json-to-an-appropriate-format-for-restadapter-emberjs

But, it’s not helping.

Here’s my Salary model

export default DS.Model.extend({ pay: DS.attr() });

I’m using the rest adapter and calling salaries from salaries route as:

export default Ember.Route.extend({ model() { return this.get(‘store’).findAll(‘salary’) }

});

Using Mozilla Nightly, I see I’m getting the response but ember inspector shows that a successful request was made and I get the response.

pay 90000 1 Object pay 75000 2 Object pay 90000 3 Object

So I need to parse in those JSON objects and use them. Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles