title: nested arrays in d3.js
body: <p>I have seen questions about dealing with “nested json” in d3.js and have seen that the proposed solutions are mostly to “flatten” the data (meaning creating a new variable and pushing in the data in desired level)
  Here two examples: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/14955820/">e.g. 1</a> and </li>
  <li><a href="https://stackoverflow.com/questions/14512523">e.g. 2 </a></li>
  </ul>
  
  <p>My question is : can one use one of the various array functions to access the level of the data without creating a new variable ? <a href="https://github.com/mbostock/d3/wiki/Arrays" rel="nofollow noreferrer">Handling arrays</a></p>
  
  <p>I have an array which looks like that: </p>
  
  <pre><code>var dataset = 
   {"directed": false, 
    "graph": [], 
    "nodes": 
   [
   {"Region": "X15", "Group": "EU", "id": "BE"}, 
  {"id": "FR"}, 
  {"id": "BG"}, 
  {"id": "DK"}, 
  {"id": "HR"}, 
  {"id": "DE"}
  ], 
  "links": 
   [
   {"source": 0, "target": 0, "weight": 0}, 
   {"source": 0, "target": 1, "weight": 130}, 
   {"source": 0, "target": 2, "weight": 1}, 
   {"source": 0, "target": 3, "weight": 36}, 
   {"source": 0, "target": 4, "weight": 4}, 
   {"source": 0, "target": 5, "weight": 117}
   ], 
   "multigraph": false}
  </code></pre>
  
  <p>I have tried the following </p>
  
  <p><strong>and Iwould like to access the weight (calculating its maximum with d3.max)</strong> </p>
  
  <pre><code>dataset.links // gives me link 
  dataset.links[0].weight // gives me the weight of first but can't get the index to work
  </code></pre>
  
  <p>when using the array functions I can't get elements lower than that </p>
  
  <pre><code> d3.entries(dataset)
   d3.values(dataset.links)
  </code></pre>
  
  <p>what am I missing ? </p>
  
  <p>I hope the question makes sense. </p>
  
  <p>P.S: if one has to flatten the array, is there any advantage of doing it in javascript or is it the same if I create the array (e.g. in python) and pass it to javascript </p>