I am trying to parse the below response body that I received from my http request.
callback({"processingDurationMillis":29,"authorisedAPI":true,"success":true,"airline":null,"errorMessage":null,"distance":"4,128.4","units":"km"})
I need help in accessing the distance field in the body, but first I am unable to change this JSON into a JS object.
Here's what I'm doing
response = HTTP.call('GET', URL,function(err,result){
console.log(result.content);
data = JSON.parse(result.content);
var extractedData = data['distanceResponse'];
console.log(extractedData);
});
I'm able to log result.content but nothing after. Please help? Thanks much appreciated!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire