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
9 minEvery common JSON error mapped to its cause and fix — trailing commas, single quotes, 'Unexpected token', JSONDecodeError — each with a dedicated guide.
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
9 minJSONPath reference: root, dot/bracket, wildcards, recursive descent, slices, filters, and RFC 9535 functions — with the canonical spec examples.
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.
Are duplicate keys valid in JSON? RFC 8259 behavior explained
8 minRFC 8259 says object names SHOULD be unique — so duplicates are legal but the behavior is unpredictable. See which value each parser keeps, how to reject duplicates in Python and JavaScript, and how to find them.
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.
Postgres: invalid input syntax for type json — causes and fixes
7 minWhy PostgreSQL rejects a value with 'invalid input syntax for type json', how to read the DETAIL line, and the exact fix for single quotes, empty strings, NULs, and double-encoded JSON.
ValueError: No JSON object could be decoded — causes and fixes
5 minThe Python 2 / requests error that means the response body was not JSON. How to see what actually came back, and the modern JSONDecodeError equivalent.
JSON objects — syntax, nesting, and common mistakes
6 minHow JSON objects work: key rules, nesting, accessing values in JavaScript and Python, duplicate keys, and the mistakes that cause parse errors.
Expecting property name enclosed in double quotes — fix
6 minPython's "Expecting property name enclosed in double quotes" means single quotes, a trailing comma, or a Python dict — the fix for each.