From the course: D3.js Essential Training

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Parsing and displaying nested JSON with nested selections

Parsing and displaying nested JSON with nested selections - D3.js Tutorial

From the course: D3.js Essential Training

Parsing and displaying nested JSON with nested selections

- [Instructor] You may be able to guess that D3 has a built-in handler for JSON, but did you know that you can bind hierarchical data easily to hierarchical elements with what's called nested selections? So you can drill down into data. JSON is everywhere these days, particularly APIs. So if you want to work with real world data, you need to learn to handle JSON. And it unlocks more complicated visualizations too, like trees and hierarchies and so on. Now we are going to look at importing some JSON and using it for nested selections. So we start with a familiar process now hopefully, we take the URL to the data. And we're going to import it here with a handler that looks and works very similar to the CSV one. So d3.json, paste that, pop that down there so you can see it a bit better. And then we say take the data without a comma and do something with it. To begin with, we will just log it to the console. So let's refresh that and we have some data, which is good. Now a couple of notes…

Contents