JSON guides
The background behind our JSON formatter. Syntax, the mistakes that break parsers, how JSON compares with other formats, and how to validate the shape of a document.
7 articles, newest first
-
JSON Schema: How to Validate the Shape of Your JSON
An introduction to JSON Schema with a complete example. Learn type, required, properties, enum, pattern and $ref, and how to run validation in JavaScript and Python.
-
How to Pretty Print JSON from the Command Line
Format and query JSON in the terminal with jq, Python, Node and PowerShell. One liners for files, curl output and clipboard contents on macOS, Linux and Windows.
-
JSON.stringify and JSON.parse Explained, Including the Surprises
How JavaScript converts between objects and JSON text, with the replacer, reviver and indent arguments, and the cases that silently lose data.
-
JSON vs YAML for Configuration Files
YAML is easier to write and JSON is harder to get wrong. See the real differences, the famous YAML gotchas, and which format to pick for your config.
-
JSON vs XML: Which Data Format Should You Use?
A practical comparison of JSON and XML covering size, readability, schemas, tooling and the cases where XML is still the right answer.
-
JSON Syntax Rules and the 10 Most Common Errors
The complete set of JSON syntax rules, followed by the ten mistakes that cause almost every Unexpected token error, each with a broken and a fixed example.
-
What Is JSON? A Beginner's Guide with Examples
JSON explained from scratch: what it looks like, the six value types, where it is used, and how it compares to a JavaScript object.