JSON (JavaScript Object Notation) is the de-facto standard for data exchange on the web. Virtually every REST API, most configuration files, and all modern databases with schema-less storage use JSON. It's human-readable, language-agnostic, and maps naturally to objects, arrays, and primitives.
| Type | Example | Notes |
|---|---|---|
| string | "hello" | Must use double quotes. Escape special chars with \ |
| number | 42, 3.14, -7 | No distinction between int and float. No NaN/Infinity |
| boolean | true, false | Lowercase only |
| null | null | Represents absence of value |
| object | {"key": "val"} | Unordered key-value pairs. Keys must be strings |
| array | [1, "a", true] | Ordered list. Can mix types |
[1, 2, 3,] — valid in JavaScript but illegal in JSON.{'key': 'value'} — only double quotes are valid.Formatting (pretty-print) adds indentation and line breaks — essential for code review, debugging, and config files committed to version control. Minifying removes all whitespace — every byte counts when sending JSON over the wire in high-traffic APIs. For large payloads, also consider gzip compression (which handles repetitive JSON structure extremely well) and binary formats like MessagePack or Protocol Buffers for maximum efficiency.
Your JSON never leaves your browser — all formatting and validation runs locally.