First of all your json is valid. If you use the example here with your json file it works fine.

The one thing I did note was that you aren't defining the 'root', 'nodes' or 'links' of your tree. check out the example at and you will note that the process of forming the data for the tree map requires these to be set.

There is a better explanation of it here.

EDIT: Ahh.. My bad. I mistook 'Treemap' for 'Tree' Apologies, this answer won't help much. Apologies.


In D3, there are layout functions that transform the data into nodes with layout data; dx, dy, x, y, etc added.

If you are using the latest version of D3, version 4 at the time of this writing, then the API is a little different.

This following line from version 3 d3.layout.treemap()

In version 4 the line should be:


Here's a good tutorial on the different layout functions in D3's latest version. Hope that helps. Your layout function may vary depending on what kind of TreeMap you're trying to create. (Partition, vanilla TreeMap, etc.)

Related Query