JSON Formatter & Validator — beautify, minify, and fix JSON
Paste any JSON to format, minify, or validate it in your browser. Errors come with line and column numbers. Permissive mode accepts the JSON5 superset — comments, trailing commas, unquoted keys. Nothing is uploaded.
How it works
Strict mode runs your input through the browser's built-in JSON.parse — the same implementation Node.js, every modern API client, and every standards-compliant parser uses. Output is produced by JSON.stringify(value, null, indent) for the chosen indent (2 spaces, 4 spaces, or tab), or by JSON.stringify(value) with no third argument for the minified form. Both functions follow RFC 8259 / ECMA-404 to the letter.
Permissive mode adds a small preprocessor that handles the three things people most commonly paste from JavaScript or config files: line and block comments (// and /* */), trailing commas before ] or }, single-quoted strings, and unquoted ASCII object keys. The preprocessor walks one character at a time with a small state machine — never a global regex pass — so a // inside a URL or a comma inside a string is left untouched. The intermediate strict-JSON text is what the actual parser sees, so error positions still line up with your visible input.
Sort-keys is a recursive, depth-first sort of every object's key set using JavaScript's default lexicographic comparator. Arrays are not reordered — JSON arrays are ordered by spec, and reordering them would change the value, not the format. When the toggle is on the output is a canonical form: the same input always produces byte-identical output, which is useful for diffs, signatures, and deterministic build artefacts.
Every successful run is silently round-trip verified: the formatter parses its own output and compares the resulting value structurally to the originally parsed value. If they ever differ the page surfaces a warning under the output. This is the credibility check the page advertises — not just "valid JSON", but "valid JSON whose meaning is identical to your input."
One thing to be aware of: JavaScript represents every number as a 64-bit IEEE-754 float, so integers above Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) silently lose precision when JSON.parse coerces them. The tool detects such values in the source text and warns under the output. For large IDs, the standard workaround is to serialise them as JSON strings on the producing end.
Worked examples
Frequently asked questions
Sources & references
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format
- ECMA-404 — The JSON Data Interchange Standard (2nd edition, 2017)
- JSON5 — Specification 1.0.0 (the relaxed superset used by tsconfig.json)
- MDN — JSON.parse / JSON.stringify reference
The parser implementation is the browser's native JSON.parse; the only custom code is the permissive-mode preprocessor and the formatter wrapper. Specifications last reviewed on 2026-05-11.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.