-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,005
  • 8
  • 41
  • 41
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
  • 20,566
  • 4
  • 34
  • 50
visualex
  • 716
  • 11
  • 17