JSON was lifted from the object literal syntax of JavaScript and standardised twice, as ECMA-404 and as RFC 8259 (December 2017), with both bodies keeping the grammar identical. The format is small: an object is a set of name and value pairs in braces, an array is an ordered list in brackets, and a value is one of six things, a string, a number, true, false, null, or another object or array. Names are strings. Whitespace is free. There is nothing else, which is why a parser exists for every language and why a document written by a Python service is read by a browser, a Go program and a spreadsheet import without conversion.
The format appears in more places than its simplicity suggests. Nearly every REST API answers in it, and a request body sent over HTTP is JSON more often than any other shape. Configuration files use it (package.json in every JavaScript project), log lines are written as one JSON object per line so that tools can filter them by field, document databases store it directly, and large language models are asked to answer in it so that a program can read the answer. Learning to read a JSON document is therefore a prerequisite for back-end work, for most front-end work and for a good part of data analysis.
| Value type | Looks like | Common error |
|---|---|---|
| string | "text in double quotes" | Single quotes are not JSON; a date is a string the reader has to parse |
| number | 42, 3.14, -1e9 | No integer or decimal distinction; large integers lose precision in JavaScript |
| boolean, null | true, false, null | A missing field and a null field are different things to most code |
| object | { "name": "value" } | Duplicate names are allowed by the grammar and handled differently by parsers |
| array | [1, 2, 3] | Order carries meaning; a reordered array is a changed document |
What JSON omits explains most of the difficulties encountered with it. There are no comments, so configuration files cannot explain themselves. There is no date type, no binary type and no way to reference one part of a document from another, so dates travel as strings in whichever convention the writer chose and files travel as base64 text. There is no schema in the format itself; JSON Schema, a separate specification, describes which fields are required and of which type, and OpenAPI descriptions of REST interfaces embed it for the same purpose. A team that adopts one of them gets validation at the boundary and documentation for free.
