samedi 4 avril 2015

Format JSON ojects for Ember / drill-down / serialize / adapter

I'm pulling some JSON with ajax (because I can't get past CORS with my limited understanding/lack of useful examples/ of the RESTAdapter...) - and I'm getting these nested objects. I need an array of the 'book' - but I'm unsure of how to format this JSON so that it's readable.




routes/books.js



import Ember from 'ember';
import ajax from 'ic-ajax';

var libraryThingApi = "http://ift.tt/1GbEbod?";

export default Ember.Route.extend({

model: function() {

var libraryData = ajax({
url: libraryThingApi + "userid=F.L.O.W.",
type: 'GET',
dataType: 'jsonp'
});

console.log(libraryData);
return libraryData;
}

});




what is returned



Promise
_id: 47
_label: "ic-ajax: unwrap raw ajax response"
...
_result: Object
books: Object
111333266: Object
title: "a book title"
111730480: Object
title: "a book title"
settings: Object
theuser: "F.L.O.W."
more_things: "etc"




Aucun commentaire:

Enregistrer un commentaire