JSON Formatter & Validator
Format, minify and validate JSON in the browser: errors with line and column and a plain hint, 2/4-space or tab indent, sorted keys, size and structure counts.
Pretty-printed or minified JSON ready to copy or download, or the exact line and column of the first error with the reason — plus key, object, array and depth counts and a warning when a number would be rounded.
Example: A 204-byte minified order record formats to 2-space JSON with 15 keys, 5 objects and 1 array at depth 4; a stray trailing comma is reported as "Line 1, column 8".
Strict grammar,
honest numbers.
What "valid JSON" means here, why the error points at a column, what formatting changes and what it never touches, and the one case where re-serialising is not lossless.
Validation
The text is checked against the RFC 8259 grammar by a small parser written for this page: objects, arrays, strings with the seven escapes and \uXXXX, numbers without leading zeros, true, false, null. It stops at the first problem and reports the line, the column and the character it found there, with a hint for the mistakes people actually make — a trailing comma, single quotes, an unquoted key, a comment, a line break inside a string. Browsers' own JSON.parse messages differ and rarely give a column, which is why the check is done here.
Formatting and minifying
Once valid, the text is parsed and written back with the indent you choose (or none). Key order is preserved unless you sort, arrays always keep their order, string content is untouched, and escape sequences are written back as the characters they stand for (\u00e9 becomes é). The counts are taken from the parsed value: keys across all objects, containers, scalars by type, and the deepest nesting level.
When re-serialising changes a value
JSON numbers are arbitrary-precision text; JavaScript stores them as IEEE-754 doubles. An integer above 2⁵³ (9,007,199,254,740,992) or a decimal with more than about 16 significant digits may not survive the round trip — 9007199254740993 comes back as …992. The validator checks every number literal against what it would be written back as and warns when they differ, so you can keep such values as strings (the usual convention for IDs) rather than discover the change later. Duplicate keys are allowed by the RFC but parsers disagree on which wins; the page warns and keeps the last, as JavaScript does.
What the tool does not do
It does not accept JSON5, JSONC or YAML, does not repair broken input (a repair would be a guess), and does not validate against a schema. Inputs up to 5 MB are processed on your own machine; nothing is uploaded. The same four anonymous usage counts as the rest of the site apply.
SOURCES
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format
- ECMA-262 — JSON.stringify and Number::toString (IEEE 754 double rounding)
Last reviewed 18 September 2026. How results are checked: How we verify.