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.