JSON is a text format for exchanging structured data. You can use it for an API response, a configuration file or a saved application state.

The examples below show its value types and how to parse it.

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.

Its syntax is defined by RFC 8259 and ECMA-404.

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 \n for a new line and \" for a quote.

Number: an integer or decimal, optionally with an exponent like 1.5e10. No quotes.

Boolean: true or false, 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".

A small syntax does not eliminate parser differences, especially for numbers and duplicate object names.

Where you will meet it

Web APIs. A REST API can send and receive JSON. The response to a request for a user, a product or a weather forecast is a JSON document.

Configuration files. package.json in 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 jsonb column type.

Logging. Structured logs are usually one JSON object per line so tools can search and filter them.

Browser storage. localStorage only 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.

Choosing between formats

XML supports features such as namespaces and mixed text content. JSON maps objects and arrays to dictionaries and lists.

Choose a format based on the contract and features your application needs.

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.

Then paste the same example into the JSON visualizer to see the object, its nested object and its array drawn as connected boxes.