I am trying to figure out a way to retrieve a Boolean value from a JSON string retrieved from an ajax query. I can access string and integer values, but any Boolean values are returned to console as undefined.
Here is my script for parsing the ajax return data.
success: function(data){
let results = jQuery.parseJSON(data);
var outside = results.outside;
console.log(outside);
if(outside){
console.log("true");
}
}
and here is an example of my JSON string:
{
"glossary": "alphabet",
"store": "Henry",
"outside": true
}
I can return the string values, but not the Boolean value of "outside". I know it is being retrieved by the ajax call because in testing I print data to the console and I can see its value as true.
Object.keys(results)say?JSON.parseand jQuery'sparseJSONmethods.