I'm currently working on a project to develop a Google Chrome extension and I've encountered an obstacle. I'm experimenting with JSON data (with the intention of integrating it with an API in the future). I have a sample JSON file, successfully loaded it into my code, and stored the parsed JSON as a variable. However, I'm unsure how to access specific values within the objects.
var xhr = new XMLHttpRequest();
var resp;
xhr.open("GET", "eg.json", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
resp = JSON.parse(xhr.responseText);
}
}
xhr.send();
After executing the send request, the object resp takes on the appearance shown here.
As someone who is relatively new to JavaScript, I'm struggling to figure out how to retrieve the createdDate value as a String variable. Any assistance would be greatly appreciated!
Thank you