JSON is the way most software on the internet exchanges data. When your phone app fetches your messages, when a website loads search results, when two servers talk to each other, the text going over the wire is very likely JSON. Here is what it is and why it won.
A first look
{
"name": "Ada Lovelace",
"born": 1815,
"languages": ["English", "French"],
"address": {
"city": "London",
"country": "UK"
},
"retired": false,
"spouse": null
}
Even without knowing the rules you can read that. It describes a person with a name, a birth year, a list of languages, a nested address, a yes or no flag and an empty field. That readability is the point.
What the name means
JSON stands for JavaScript Object Notation. Douglas Crockford popularised it in the early 2000s after noticing that the syntax JavaScript already used for writing objects was a good general purpose data format. It was standardised as ECMA-404 and RFC 8259. Despite the name it has nothing to do with running JavaScript. Every language can read and write it.
The six value types
JSON has exactly six kinds of value and nothing else:
- Object: curly braces containing key and value pairs. Keys are always strings in double quotes. Order is not guaranteed to be meaningful.
- Array: square brackets containing an ordered list of values. Values can be of mixed types.
- String: text in double quotes. Special characters are escaped with a backslash, such as
\nfor a new line and\"for a quote. - Number: an integer or decimal, optionally with an exponent like
1.5e10. No quotes. - Boolean:
trueorfalse, lowercase, no quotes. - Null: the word
null, meaning no value.
Objects and arrays can nest inside each other to any depth. That is how JSON represents complex structures. We go through the exact syntax rules and the errors people hit in JSON Syntax Rules and Common Errors.
What JSON does not have
The strictness is deliberate. JSON has no comments, no dates, no trailing commas, no single quotes and no way to reference one part of the document from another. A date is just a string in an agreed format like "2026-09-22". This keeps parsers tiny and identical across languages.
Where you will meet it
- Web APIs. Nearly every REST API sends and receives JSON. The response to a request for a user, a product or a weather forecast is a JSON document.
- Configuration files.
package.jsonin Node projects,tsconfig.json, VS Code settings, and countless others. - Data storage. Document databases such as MongoDB and CouchDB store JSON-like records. PostgreSQL has a native
jsonbcolumn type. - Logging. Structured logs are usually one JSON object per line so tools can search and filter them.
- Browser storage.
localStorageonly stores strings, so apps serialise their state to JSON.
JSON is text, not an object
This confuses beginners. JSON is always a string of characters. To use it in a program you parse it into the language's native structure, and to send it you serialise back to text. In JavaScript that is JSON.parse and JSON.stringify, covered in JSON.stringify and JSON.parse Explained. In Python it is json.loads and json.dumps. Every language has an equivalent pair.
Why it beat the alternatives
Before JSON, web services mostly used XML. XML is more powerful but far more verbose, and mapping it onto program objects is awkward. JSON maps directly: an object becomes a dictionary, an array becomes a list. It is also smaller on the wire and easier to read. The comparison in JSON vs XML goes into detail. For configuration files YAML is a common alternative, weighed up in JSON vs YAML.
Try it
Copy the example at the top of this page into our JSON formatter. Click Minify to see it squeezed to one line, then Format to get it back. Delete a comma and click Validate to see how a parser reports the error.