About the JSON Cheat Sheet
JSON has a famously small grammar, and this page lays out all of it: six value types, the punctuation rules, the string escapes and the exact shape a number is allowed to take. A dedicated table puts a dozen numeric literals side by side with a verdict and a reason, which settles the recurring arguments about leading zeros, bare plus signs and hexadecimal.
Because most JSON trouble arrives as a parser message rather than a specification question, one table maps the errors you really see, from Unexpected end of JSON input to Converting circular structure to JSON, onto their usual cause. Another walks through valid and invalid snippets so you can pattern match against your own file. The JavaScript API table covers the replacer and reviver arguments almost nobody uses, along with the values that vanish during serialisation.
The reference closes with the neighbouring formats you meet in configuration files, among them JSONC, JSON5, NDJSON, JSON Patch and JSON Pointer, then twenty JSON Schema keywords and a JSONPath primer. Filter for schema or path to land there directly. When you need to act on a document instead of reading about one, the JSON Formatter, JSON Validator and JSONPath Tester are one click away.
How to use
- Leave the section on All sections for the complete reference, or pick Common errors and fixes when a parse is failing.
- Filter by a keyword such as escape, schema or comma to shrink the tables to the rows you need.
- Copy the Markdown version into your project notes, or download it as a file.
Common questions
- Can JSON have comments?
- No, the specification defines no comment syntax at all. Switch to JSONC or JSON5 if your tool understands them, or strip the comments before parsing.
- Are trailing commas allowed in JSON?
- Never. A comma before a closing brace or bracket is a syntax error in every conforming parser, even though a JavaScript object literal accepts it.
- How do I store a date in JSON?
- There is no date type, so write an ISO 8601 string such as 2026-03-01T09:30:00Z or a numeric Unix timestamp, and convert it back after parsing.
- Why do large numbers lose digits after parsing?
- JSON numbers become IEEE 754 doubles in JavaScript, exact only up to 9007199254740991. Send larger identifiers as strings to keep every digit.
- Is a bare string valid JSON?
- Yes. Since RFC 8259 any single value forms a complete document, so "hello", 42 and null all parse successfully.