What Is JSON
JSON (JavaScript Object Notation) is a text format for structured data, defined by RFC 8259. It represents objects as key/value pairs and lists as arrays, using six punctuation characters and a strict type system. Every web API, config tool and database today can read it — and it is deliberately simple enough to learn in an afternoon.
Die folgende Anleitung ist nur auf Englisch verfügbar.
What Is JSON explained
JSON is the format data arrives in. When a weather app shows tomorrow's forecast, a spreadsheet exports records, or a configuration file ships with a service, the text moving between those systems is almost always JSON: braces holding keys and values, square brackets holding lists, and a small set of rules about strings and numbers that every programming language agrees on.
It was extracted from JavaScript's object-literal syntax around 2001 and standardised first as RFC 4627, later revised as RFC 8259, which is the version in force today alongside the identical ECMA-404 standard. The name still says JavaScript, but the format is language-neutral by design — Python, Java, Go, C#, SQL and your text editor all speak it fluently, which is precisely why it became the default way programs exchange data.
This guide explains what JSON actually consists of — its six data types, its two containers, its escaping rules — with copyable examples for each. Wherever an explanation produces a practical next step, the linked tool runs in your browser: you can format, validate or convert the very example you just read without installing anything.
The fastest way to internalise the syntax rules below is to break them on purpose and watch a parser react — the JSON Formatter will show you the exact line and column of every mistake.
Once you want every rule on one reference page, the JSON syntax cheat sheet compresses this guide into a lookup table.
The two containers: objects and arrays
Everything in JSON is built from two structures. An object is an unordered set of key/value pairs wrapped in braces — the keys are always strings, the values can be any JSON value, and pairs are separated by commas. An array is an ordered list of values wrapped in square brackets, and its values may be of any mix of types.
An object (key/value pairs)
{
"name": "Ada Lovelace",
"born": 1815,
"mathematician": true
}An array (ordered values)
[ "analytical engine", 1843, null ]
The six data types
Four are scalars — string, number, boolean and null — and two are the containers above. The rules that surprise newcomers are few but strict: strings are always double-quoted (single quotes are invalid), numbers need no quotes and cannot be written in hexadecimal, booleans are the exact lowercase tokens true and false, and null is its own value meaning deliberately empty.
| Type | Examples | Rule worth remembering |
|---|---|---|
| string | "hello", "café", "é" | Double quotes only; escape " and \ inside |
| number | 42, -3.14, 2.1e10 | No hex, no NaN, no leading zeros |
| boolean | true, false | Lowercase only — True is invalid |
| null | null | Means intentionally empty, not zero |
| object | {"key": "value"} | Keys are strings; trailing commas forbidden |
| array | [1, "two", null] | Order preserved; mixes allowed |
Escaping: what can live inside a string
Inside a string, two characters must be escaped wherever they appear: the double quote (as \") and the backslash (as \\). Six more escapes exist for control characters — \n newline, \t tab, \r carriage return, \b backspace, \f form feed, and \/ for the forward slash, which is legal but optional. Any other character can appear literally as UTF-8, or as a \uXXXX escape for its Unicode code point — both forms mean exactly the same string to a parser.
Escaped form
"path": "C:\\Users\\ada" "quote": "she said \"hi\"" "emoji": "\ud83d\ude00"
What a parser delivers
path: C:\Users\ada quote: she said "hi" emoji: 😀
Whitespace, formatting and why pretty-printing exists
Between the structural punctuation, JSON allows exactly four whitespace characters: space, tab, newline and carriage return. That allowance is what makes formatting possible — the same document can be one unreadable line on the wire and an indented tree in your editor, and both are byte-for-byte the same data to a parser. Formatting changes nothing about meaning, which is why the formatter tool is safe to run on any payload and why minified JSON is the standard choice for transport.
- No comments: RFC 8259 removed comments deliberately, after real-world parser divergence. JSONC is the unofficial extension some tools accept.
- No trailing commas: [1, 2, 3,] is invalid, however friendly it looks.
- Duplicate keys: parsers keep either the first or the last — RFC 8259 leaves it to implementations, which is why duplicates are a bug even where they parse.
- Any top level: any value may be a whole document — an array of numbers is complete JSON.
Where JSON is used — and where it is not
JSON owns three territories: API request and response bodies, structured configuration where comments are not missed, and data at rest in document databases. It shares the wire reluctantly with two neighbours — binary formats like protobuf, which win on size and speed when both ends share a schema, and YAML, which wins on hand-editability for ops config. Understanding JSON deeply is therefore not one skill among many; it is the prerequisite for reading both of those neighbours, because YAML 1.2 parses JSON and most binary schemas document themselves with JSON examples.
Frequently asked questions
What does JSON stand for?
JavaScript Object Notation. The syntax was extracted from JavaScript's object literals by Douglas Crockford around 2001, but the format itself is language-neutral: RFC 8259 defines it as a text format that any programming language can emit and parse, which is why it became the universal interchange format rather than a JavaScript feature.
Is JSON a programming language?
No — it is a data format with no execution semantics. It cannot express logic, variables or functions, only structure: objects, arrays and four scalar types. The strictness is deliberate; RFC 8259's grammar fits on roughly one page, which is the property that let every language implement it identically.
What is the difference between JSON and JavaScript objects?
Three visible ones: JSON requires double-quoted keys, forbids trailing commas, and has no undefined, functions or comments. A JavaScript object literal like {name: 'ada'} is not valid JSON — {"name":"ada"} is. Conversely every valid JSON document parses as a JavaScript object, which is why the two are so often confused.
Why does JSON not allow comments?
Douglas Crockford removed them deliberately: early format negotiations showed vendors stuffing parsing directives into comments, which broke interoperability. If you need annotation, the convention is a sibling key like "//" or "_comment", or JSONC where the toolchain supports it — but wire JSON stays comment-free by design.
How do I check whether my JSON is valid?
Paste it into a validator — this site's JSON Validator parses against RFC 8259 locally and reports the exact line and column of the first syntax error, in your browser. Common failures are single quotes, trailing commas, unquoted keys, and smart quotes pasted from a word processor.
Is JSON safe to parse?
Parsing JSON text is safe; what a parser hands you can still be dangerous if you execute it. Two classical pitfalls: using JavaScript's eval instead of JSON.parse (eval executes code), and unbounded entity expansion in XML-influenced tooling. A standards-compliant parser like the ones in browsers has depth and size limits and never executes anything.
Which related tools should I use next?
- JSON FormatterIndent, sort keys and strip comments with configurable output.Open
- JSON ValidatorValidate syntax with exact line and column, and repair it in one click.Open
- JSON Syntax Cheat SheetPlain-English guideOpen
- JSON to CSVConvert records to a spreadsheet grid, nesting and all.Open
- JSON EscapingPlain-English guideOpen
- JSON vs YAMLHead-to-head comparisonOpen