JSON
Also known as: JavaScript Object Notation, RFC 8259 JSON
JSON (JavaScript Object Notation) is a lightweight text format for structured data — built from objects, arrays, strings, numbers, booleans, and null — that's become the lingua franca of web APIs, configuration files, and data interchange between services.
Overview
JSON is defined by RFC 8259. The grammar is small: an object is a comma-separated list of string keys mapped to values inside curly braces; an array is a comma-separated list of values inside square brackets; values are strings (double-quoted), numbers (no leading zero, no NaN, no Infinity), 'true', 'false', or 'null'.
The strictness matters. Comments are not allowed. Trailing commas are not allowed. Keys must be quoted. Single quotes are not allowed. JavaScript object literals are NOT valid JSON. Always validate with a parser before assuming a payload is JSON.
JSON is human-readable but verbose. Binary alternatives like CBOR, MessagePack, and Protocol Buffers compress better when payload size matters, at the cost of needing a special decoder.
Common questions about JSON
Is JavaScript syntax valid JSON?
Can JSON represent dates?
Is JSON a strict subset of JavaScript?
Tools that work with JSON
Related concepts
Base64
Base64 is a way of encoding arbitrary binary data as a string of 64 ASCII characters (A–Z, a–z, 0–9, '+', '/') so it can travel through systems that only handle plain text — like email, URLs, JSON, or HTML data URIs.
Floating-point number
A floating-point number stores a value as a binary fraction scaled by a power of two. JavaScript's Number is an IEEE 754 double with 53 significant bits, so integers above 2^53 − 1 (9,007,199,254,740,991) and most decimal fractions, 0.1 included, cannot be stored exactly.