I am sending a http request to a website (from node.js) which returns a JSON object. I get the expected JSON file. However when I parse the JSON text, my program isn't able to do anything.
var URL = 'http://www.omdbapi.com/?t=' + movie + '&y=&plot=short&r=json';
requestify.get(URL).then(function (response) {
console.log(response.getBody()); // It prints correctly
var jsonBody = response.getBody();
var jsonObject = JSON.parse(jsonBody);
if (jsonObject.Response == 'False') {
console.log('False'); //not printed
} else {
console.log('true'); //Not printed
}
});
Sample JSON output:
{"Response":"False","Error":"Movie not found!"}