🌐 English

Home › Guides

How to Read JSON: A Beginner's Guide

JSON is the most common text format for exchanging data. It looks unfamiliar at first, but it follows only a handful of rules. Once you know braces, brackets and the value types, you can read almost any JSON file.

The basic shape

JSON is a collection of name and value pairs. Each pair is a key and its value, and the key is always wrapped in double quotation marks. A colon sits between key and value, a comma separates pairs, and curly braces { } wrap the pairs into one object.

For example, {"name": "Hana", "age": 31} is an object with two pairs. Line breaks and indentation do not change the meaning, so formatting a file in a tidy layout is a good first step before reading it. Pasting a long one-line JSON into a formatter makes the structure obvious right away.

The six kinds of values

A value can only be one of a small set of kinds: text (in double quotation marks), a number, true or false, null for empty, a list in square brackets, or another object. Nesting these builds complex structures.

A number has no quotation marks, while "31" in quotes is text. That difference matters during conversion, because whether you can total a column depends on whether the values are numbers or text.

Reading lists and nesting

Square brackets [ ] form an ordered list. A list of objects looks just like the rows of a table: [{"name": "A"}, {"name": "B"}] is a table with two rows.

When an object or list sits inside another, that is nesting. Read from the outermost bracket and peel one layer at a time, checking that every opening bracket has a matching closing bracket.

Common mistakes

JSON is strict, so tiny slips make a file unreadable. The same few mistakes appear again and again when people edit by hand.

When you see an error, do not reread the whole file. Start near the spot you edited last and check commas and quotation marks first.

Moving between tables and JSON

Rows and columns map neatly onto a list of objects. The CSV to JSON tool on this site uses the header row as keys and builds one object per row, while the JSON to CSV tool spreads a list of objects back into a table.

Deeply nested JSON does not fit on a single flat sheet. Nested values may end up as text in one cell or as combined column names, so always scan the result after converting.