-1

I need to load a JSON file (done) and then parse it in order to access the data to load the links of a Collapsible Force Layout.

//Load json from local server
$.getJSON("simulator.json", function(json) {
      console.log(json);
});
Martin
  • 2,135
  • 8
  • 39
  • 42
Rui Oliveira
  • 1
  • 2
  • 7

1 Answers1

-1

Usually the JSON is gone over in a loop like so:

for(a in json){
  //see a child object like this
  console.log(json[a]);
  //if it has a property, you can acccess it like so:
  link = json[a].link;
  //if it has child objects you can continue to iterate
  for(b in json[a]){
   console.log(json[a][b]);
  }
}
jjmontes
  • 24,679
  • 4
  • 39
  • 51
visualex
  • 736
  • 12
  • 17