dimanche 29 mars 2015

How to parse body received as html request

I am using a node lib called request to get data from an api as below and i get all result in body now i need to parse this body and i have no idea on how to parse this body to get information



request('http://ift.tt/1e91X73'+mov.imdb.id+'?
api_key=0ac03f4da6c7b6e181af8a4eafc6a1bb', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
console.log(body.adult); // Show the HTML for the Google homepage.
}
})


body received is in following format



body" '{"adult":false,"backdrop-path":"/somepath","poster-path:"somepath"}


How do i get values of let say poster-path from this body in my node code , i need help as soon as possible . Thanks


Aucun commentaire:

Enregistrer un commentaire