I’m using the themoviedb.org’s API to retrieve information about films. It’s returning this JSON data.
I need to filter this in two different ways, but not necessarily in the same callback. In one instance I only need to return the genres, and in another instance I need to return only the “backdrops” where size.toLowerCase() == 'original', and both instances take place in a success for an ajax call, i.e.:
$.ajax({
url: "http://api.themoviedb.org/2.1/Movie.getInfo/en/json/API_KEY/" + filmID,
dataType: "jsonp",
context: document.body,
success: function(data){
...
}
});
Would grep or map be the proper method to use here? Regardless, how can I efficiently retrieve this info?
you would use grep for filtering out the right things you wanted and placing them in another array, map would be to add further things to the JSON by performing a specific function on each element