Chrome JSON extension issue

I am creating a google chrome extension as a project and run into an obstacle. I play with JSON (hopefully end up using an API that I like). I have an example JSON file, upload it, get a variable that stores the analyzed JSON (which I can see as an object containing objects and values), however I do not know how to refer to the values ​​of objects inside.

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();

The resp object looks like this after submission.

I assume this is due to the fact that I'm new to JavaScript, but how would I get the createdDate variable as String?

thank

0
source share
1 answer

dot bracket ( ) ( ), . , , , :

var createdDate = resp.WhoisRecord.audit.createdDate;

, , if, resp , ... xhr.onreadystatechange =, , , readyState == 4 .

+1

Source: https://habr.com/ru/post/1791700/


All Articles