mercredi 31 décembre 2014

JSON Data using ember.js

The following is an API resonpse (sample url http://ift.tt/1wxAZMH)



{
"results":[
{
"id":"4422",
"updated":"Mon Jun 26 15:01:05 GMT 2006",
"description":"Meet fellow Social Networkers near you! Come to a local Social Networking Meetup to make valuable social connections and cultivate relationships with other elbow-rubbers in your area.",
"name":"Social Networking",
"link":"http:\/\/socialnetwork.meetup.com\/",
"urlkey":"socialnetwork",
"members":"245701"
}
],
"meta":{
"id":"",
"title":"Meetup Topics",
"count":1,
"updated":"",
"description":"API for accessing meetup topics",
"next":"",
"link":"http:\/\/api.meetup.com\/topics\/",
"method":"Topics",
"total_count":3063,
"url":"http:\/\/api.meetup.com\/topics\/\/?order=members&key=1&page=1&format=json&desc=0&offset=0",
"prev":""
}
}


Using plain javascript, I can do



var req = new XMLHttpRequest();
req.open('GET', 'http://ift.tt/1wxAZMH', false);
req.send();
json = req.responseText;
object = JSON.parse(json)['results'];
console.log(object.id);
console.log(object.link);


How do I get that using ember.js and ember-data , able to access properties ?





Aucun commentaire:

Enregistrer un commentaire