What is JSON? A complete syntax overview
JSON explained from first principles: structure, data types, and how to read and write it correctly.
JSON (JavaScript Object Notation) is a lightweight text format for structured data. It was extracted from JavaScript object literals in the early 2000s and has since become the default interchange format for APIs, configuration files, and inter-process messages.
The six value types
- string — double-quoted Unicode text:
"hello" - number — integer or floating-point:
42,3.14,-1e9 - boolean —
trueorfalse(lowercase) - null — the absence of a value
- array — ordered list in square brackets:
[1, 2, 3] - object — key/value map in curly braces:
{ "k": "v" }
A complete example
{
"name": "Ada",
"age": 36,
"admin": true,
"tags": ["math", "engineering"],
"address": null
}The rules in one paragraph
Strings and keys must use double quotes. Numbers can't have leading zeros or trailing dots. Booleans are lowercase. There are no comments. There are no trailing commas. The whole document has exactly one root value.
That's it. The simplicity is the point — JSON parsers exist in every language and they all agree.