The format behind almost every web app
If you’ve ever built a website, used an API, or opened a config file, you’ve encountered JSON. It stands for JavaScript Object Notation, but despite the name, it’s used in Python, Ruby, Go, Java, and virtually every other language. JSON is simply a way to structure data as text so it can be stored, transmitted, and read by both machines and humans.
JSON became the dominant data format for web APIs in the 2000s, replacing XML as the standard for sending structured data between a server and a browser. Today, nearly every REST API returns JSON, and most configuration files — package.json, tsconfig.json, appsettings.json — use it.
Use JSON Formatter to read and validate JSON instantly.
What JSON looks like
JSON is built from two structures: objects (key-value pairs) and arrays (ordered lists). Here’s a simple example:
{
"name": "Alice",
"age": 30,
"skills": ["JavaScript", "Python", "SQL"],
"address": {
"city": "London",
"country": "UK"
}
}
Everything in JSON is either a string (in double quotes), a number, a boolean (true or false), null, an object (curly braces), or an array (square brackets). That’s the entire spec. The simplicity is what made JSON win.
The six data types in JSON
String — Text wrapped in double quotes. Single quotes are not valid JSON. "hello world" is valid; 'hello world' is not.
Number — Integer or decimal. 42, 3.14, -7 are all valid. Numbers don’t use quotes.
Boolean — Either true or false, lowercase only. True and TRUE are not valid.
Null — Represents an empty or absent value: null.
Object — A collection of key-value pairs wrapped in curly braces. Keys must always be strings in double quotes.
Array — An ordered list of values wrapped in square brackets. Arrays can contain any mix of types, including other arrays and objects.
Common JSON mistakes beginners make
Trailing commas — The last item in an object or array cannot have a trailing comma. {"a": 1, "b": 2,} is invalid. This trips up JavaScript developers because JS objects allow trailing commas.
Single-quoted strings — All strings, including object keys, must use double quotes. {'name': 'Alice'} is not valid JSON even though it looks like a JavaScript object.
Comments — JSON does not support comments. // this is a comment inside a JSON file will cause a parse error.
Unquoted keys — {name: "Alice"} is JavaScript object literal syntax, not JSON. Every key needs quotes.
Where you’ll encounter JSON in practice
API responses — When you fetch data from any modern web API, the response body is almost always JSON. Parsing it with your language’s built-in JSON parser gives you a native object or dictionary to work with.
Configuration files — Node.js, TypeScript, ESLint, Prettier, VS Code extensions — all use JSON for configuration. These files often allow comments (JSONC format) but pure JSON does not.
Local storage — Browsers store data in localStorage as strings. Serializing a JavaScript object to JSON (with JSON.stringify()) and parsing it back (with JSON.parse()) is the standard way to persist structured data in the browser.
Database documents — NoSQL databases like MongoDB and CouchDB store data as JSON documents. PostgreSQL and MySQL also support JSON column types for semi-structured data.
Reading minified JSON
APIs often return JSON in minified form — everything on one line with no spaces or indentation. This is fine for machines but hard for humans to read. Pasting minified JSON into a formatter immediately reveals the structure:
{"user":{"id":1,"name":"Alice","roles":["admin","editor"]}}
Becomes:
{
"user": {
"id": 1,
"name": "Alice",
"roles": ["admin", "editor"]
}
}
Use JSON Formatter to format, validate, and inspect any JSON payload without installing anything.
JSON vs. other data formats
XML — JSON’s predecessor for API data. More verbose, harder to read, slower to parse. Still used in legacy enterprise systems and RSS feeds.
YAML — Human-friendly format popular for configuration files (Docker, Kubernetes, GitHub Actions). Supports comments and multiline strings. Not used for API data due to parsing complexity.
CSV — Plain tabular data. Simple but only handles flat data — no nesting, no types. Good for spreadsheet data, bad for anything hierarchical.
For web APIs and configuration files, JSON is the default choice unless you have a specific reason to use something else.

