What Is JSON? A Plain-English Guide
JSON stands for JavaScript Object Notation. It is a text format for storing data and moving it around, and it is almost certainly what arrives when an app asks a server for something. Settings files use it. Services use it to talk to each other. It took over because it reads well enough for a person and parses strictly enough for a machine, which is a harder combination to land than it sounds.
What JSON looks like
A complete JSON document describing one user:
{
"name": "Ada Lovelace",
"age": 36,
"isAdmin": true,
"skills": ["mathematics", "analysis"],
"address": {
"city": "London",
"country": "UK"
},
"nickname": null
}You can read that without knowing a single rule: a user called Ada, 36, an admin, two skills, an address in London. The readability is deliberate.
The six value types
Every value in JSON is one of six things:
- Strings: text in double quotes, like
"London". - Numbers:
36or3.14, written without quotes. - Booleans:
trueandfalse, lowercase. - Null:
null, meaning a value that is deliberately absent. - Arrays: ordered lists in square brackets, like
["a", "b"]. - Objects: groups of key and value pairs in curly braces. Every key is a quoted string.
Arrays and objects nest inside each other to any depth, and that is the whole trick. Six types plus unlimited nesting turn out to describe everything from a two-line config file to an entire product catalog.
The rules that make it strict
Strictness is where JSON earns its reliability, and where newcomers lose an afternoon. Keys and strings take double quotes, never single. Commas separate items, but a comma after the last item is an error. There is no comment syntax at all. Values that JavaScript is perfectly happy with, like undefined and NaN, are not legal JSON. Break any of those and a parser rejects the whole document; nothing is almost valid. Our guide to fixing common JSON errors walks through each failure with a broken example and its fix.
Where you’ll meet JSON
APIs are the obvious place. Nearly every web and mobile app fetches its data as JSON from a server. Configuration is the other big one, from package.json in every JavaScript project through to editor settings and app manifests. After that it turns up wherever data is stored or handed off: document databases like MongoDB keep JSON-shaped records, most SaaS products export your data as JSON, and log pipelines, webhooks and message queues all speak it.
JSON vs a JavaScript object
The name misleads. JSON is not JavaScript; it is a language-independent text format that borrowed JavaScript’s literal syntax and then narrowed it. In practice that means quoted keys, only the six value types above, and text that has to be parsed with something like JSON.parse before your code can touch it.
Python, Java, Go, Rust, PHP and Ruby all ship a JSON parser, which is the entire reason the format works as a common tongue between systems that share nothing else. Where XML and YAML fit alongside it is covered in JSON vs XML vs YAML.
Getting a feel for it
Reading real JSON beats reading rules about JSON. Paste an API response into the JSON Viewer and open it up as a collapsible tree, or run it through the JSON Formatter to turn a minified wall of text into something indented. Write a few lines by hand and the JSON Validator will tell you straight away whether you got the rules right, and point at the line if you didn’t.