title: d3.nest() key and values conversion to name and children
body: <p>I am working on creating a Treemap from a csv file.
  The data in the csv file is hierarchical, as a result I used <code>d3.nest()</code>.</p>
  
  <p>However, the resulting JSON is in the form of <code>{key:"United States", values:[...]}</code>.
  The zoom-able <a href="http://mbostock.github.io/d3/talk/20111018/treemap.html" rel="nofollow noreferrer">treemap</a> requires hierarchy as <code>{name:"United States", children:[...]}</code>.
  I have tried replacing name and children to key and values in the example, but it doesn't work.</p>
  
  <p>If anyone has already looked into using key and values on a zoomable treemap, please help. I am new to D3 and I don't know whether d.children means structure or value from the data.</p>
  
  <p>This is the code to convert World Continents, Regions, and Countries from CSV to a hierarchy using d3.</p>
  
  <pre><code>$ d3.csv("../Data/WorldPopulation.csv", function (pop) {
      var treeData= { "key": "World", "values": d3.nest()
     .key(function (d) { return d.Major_Region; })
     .key(function (d) { return d.Region; })
     .key(function (d) { return d.Country; })
     .entries(pop)
  };
  </code></pre>
  
  <p>The first few lines of the result is:</p>
  
  <pre><code> `[{"key":"AFRICA","values":[{"key":"Eastern Africa","values"
   [{"key":"Burundi","values":[.........`
  </code></pre>
  
  <p>I can not use the zoomable treemap because it requires name and children labels in json rather than key and values.</p>