JSON guides & references
Short, opinionated articles on the parts of JSON you actually run into. No fluff, plenty of examples.
What is JSON? A complete syntax overview
6 minJSON explained from first principles: structure, data types, and how to read and write it correctly.
Common JSON errors and how to fix them
7 minThe mistakes that cause 90% of JSON parse failures — with examples and fixes for each.
JSON vs YAML vs XML: which should you use?
8 minA side-by-side comparison covering syntax, performance, tooling, and where each format shines.
How to escape characters in JSON
5 minThe complete escape table, the difference between \u and \x, and why your backslashes vanish.
JSON comments — why they don't exist and what to do instead
5 minJSON has no comment syntax. Here are five practical workarounds, ranked.
Trailing commas in JSON, explained
4 minWhy every parser rejects them, when JSON5/JSONC do allow them, and how to clean them up.
JSON data types: a complete reference
6 minstring, number, boolean, null, array, object — what's allowed in each, with edge cases.
How to validate JSON in JavaScript, Python, and Bash
7 minIdiomatic snippets for the three languages you reach for most when wrangling JSON.
JSONPath cheatsheet: selectors, wildcards, and filters
6 minEverything you need to query JSON: dot vs bracket notation, wildcards, slices, and filter expressions.
JSON best practices for APIs
9 minNaming, nullability, dates, errors, and pagination — pragmatic conventions for production APIs.
Unexpected token in JSON — causes and fixes
6 minWhat 'Unexpected token' means, why it appears at different positions, and how to find and eliminate the offending character.
JSON parse error at position 0 — causes and fixes
5 minWhy JSON parsers fail immediately at byte 0 — empty string, BOM, HTML error page, undefined — and the exact fix for each.
Duplicate keys in JSON — what parsers do and how to fix them
5 minRFC 8259 leaves duplicate-key behavior undefined. Here's what real parsers actually do, why it's almost always a bug, and how to find and fix duplicates.
SyntaxError: Unexpected token '<' in JSON — HTML returned instead of JSON
5 minWhy your JSON parser sees '<' at position 0, how to detect that your server sent an HTML error page instead of JSON, and the exact fetch pattern that prevents it.
Unexpected end of JSON input — causes and fixes
5 minWhy 'Unexpected end of JSON input' appears, the four most common root causes, and how to find the missing bracket or quote that truncated your document.
Python JSONDecodeError — json.loads() error causes and fixes
6 minEverything you need to diagnose a Python json.loads() or json.load() failure: error attributes, the six most common causes, and code fixes for each.
TypeError: Converting circular structure to JSON — cause and fix
6 minWhy JSON.stringify throws 'Converting circular structure to JSON', how to detect cycles, and four battle-tested patterns for serializing circular data safely.
JSON.stringify returns undefined — what to do
5 minWhen and why JSON.stringify returns undefined instead of a string, and how to serialize undefined values, functions, and symbols the way you actually intended.
JSON.parse() in JavaScript — complete guide with examples
7 minEverything about JSON.parse(): syntax, the reviver parameter, error handling, and safe parsing patterns for fetch responses and localStorage.
JSON.stringify() in JavaScript — complete guide with examples
7 minMaster JSON.stringify(): the replacer, space parameter, toJSON(), and how to handle circular references, dates, and undefined values.
How to read and write JSON files in Python
6 minComplete guide to Python's json module: json.load(), json.loads(), json.dump(), json.dumps(), and common errors — with real-world examples.
JSON arrays — syntax, examples, and common mistakes
5 minHow JSON arrays work: syntax rules, nesting, mixed types, accessing elements in JavaScript and Python, and the mistakes that cause parse errors.
JSON Schema guide — validate your data structure with examples
8 minLearn JSON Schema from scratch: types, required fields, patterns, nested objects, arrays, and how to validate real API payloads.