JSON
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. It represents data as a small set of structures (objects, arrays, strings, numbers, booleans, null) that map naturally to native types in most programming languages, which is why it has become the default payload format for web APIs.
Structure
- Object:
{ "key": value }with string keys - Array:
[ value, value, ... ] - String: double-quoted, with backslash escapes
- Number: integer or floating-point, no NaN or Infinity
- Boolean:
trueorfalse - Null:
null
Variants and related formats
- JSONC. JSON with comments, used in some config files.
- JSON5. Relaxed JSON allowing trailing commas, single quotes, and unquoted keys.
- JSON Lines (NDJSON): one JSON object per line, used for streaming and logs.
- BSON: binary JSON with extended types, used by MongoDB.
- JSON Schema: a schema language for validating JSON documents.