I’m new to Backbone.js and working with JSON.
I’m having trouble working with the following JSON:
http://pastebin.com/FFEwc0Fb
What I want to achieve is to
- create a model of that JSON data
- bind the model to a view
- bind the view to a template and learn how to show certain attributes of the data e.g. feed->title and the titles of each playlists which is feed->entry->array->title
Could someone provide sample code of that does the above or point me in the right direction?
Possible Alternative Solutions: I’m also using Rails in my App so I could use try using Rails to turn the JSON into the JSON I want it to be …
look at the parse method on models and collections. After you make your fetch the response is always passed through a parse function that you define on your model or collection. In there you can go through the object and build up the attributes to be set to the model how you want them. For example:
That’s a small example of how you could do it within backbone.