...
/Understanding JavaScript Object Notation (JSON)
Understanding JavaScript Object Notation (JSON)
Learn about the JSON format in detail and how to use it to present your D3 data.
We'll cover the following...
One of the most useful things you might want to learn when understanding how to present your data with D3 is how to structure your data so that it is easy to use.
Types of data
As explained earlier in the course, there are several different types of data that can be requested by D3, including text, Extensible Markup Language (XML), HyperText Markup Language (HTML), Comma Separated Values (CSV), Tab Separated Values (TSV), and JavaScript Object Notation (JSON).
CSV/TSV
Comma-separated values and tab-separated values are fairly well-understood forms of data. They are expressed as rows and columns of information that are separated using a known character. While these forms of data are simple to understand, it is not easy to incorporate a hierarchy structure to the data. And when you try, it isn’t natural and makes managing the data difficult.
JSON
JavaScript Object Notation (JSON) presents a different mechanism for storing data. A lightweight description could read: “JSON is a text-based open standard designed to present human-readable data. It is derived from the JavaScript scripting language, but it is language and platform-independent.”
Unfortunately, when I first started using JSON, I struggled with the concept of how it was structured in spite of some fine descriptions on the web. So the ...