JSON Formatter

Format, validate, and minify JSON instantly. Runs in your browser - nothing uploaded.

0 characters

The browser's native JSON.parse is the same strict RFC 8259 parser that consumes the payload in production, and it is what your input meets here before being re-serialized with two-space indentation. When parsing fails you get an Invalid JSON flag and no output, deliberately: a formatter that guesses past broken JSON hides the bug you came to find.

What strict parsing rejects that other tools wave through

JSON.parse refuses everything JavaScript object literals tolerate: trailing commas, single-quoted strings, unquoted keys, comments, NaN, and Infinity. So {"a": 1,} is invalid here even though every JS engine accepts it as code, and config copied out of a .js file usually fails on the first unquoted key.

The more frustrating failures are invisible. A UTF-8 byte-order mark from Windows tooling makes a file unparseable even though it looks identical to valid JSON. Text that passed through Slack, Word, or a CMS arrives with curly quotes — U+201C instead of U+0022 — which look nearly identical to straight quotes in a monospace textarea. When perfect-looking input keeps failing, re-type the first quote by hand.

Formatting is re-parse and re-serialize, and that can change values

The output is a fresh serialization of the parsed data, not your input with whitespace added. Numbers are normalized — 1.50 becomes 1.5, 1e2 becomes 100 — because JSON cannot preserve the original spelling of a number. Integers beyond 2^53 silently lose precision: 9007199254740993 comes back as 9007199254740992, which is why careful APIs ship database IDs as strings. When an object repeats a key, the last occurrence wins; the earlier one vanishes without warning.

The Minify button reverses the operation, collapsing to a single line with no spaces. It prefers the current output pane over the input, so you can format to inspect, then minify for an HTTP body or an environment variable in one pass.

Format (2-space indent)
Input: {"user":{"id":42,"tags":["admin","ops"]},"active":true}
Output: { "user": { "id": 42, "tags": [ "admin", "ops" ] }, "active": true }
Every array element gets its own line — verbose for long arrays, but diffs cleanly in git.
Precision loss above 2^53
Input: {"id": 9007199254740993}
Output: { "id": 9007199254740992 }
The parse succeeds and the tool reports Valid JSON — the corruption is silent. Keep 64-bit IDs as strings.

Questions people ask

My JSON validates on another site but fails here. Why?

Many validators are lenient JSON5-style parsers that accept trailing commas, comments, and single quotes. This tool matches fetch().json(), Python's json module, and virtually every production deserializer: if it fails here, it will fail somewhere that matters.

The output changed my numbers. Is that a bug?

No — all JSON numbers become IEEE 754 doubles on parse, so trailing zeros, exponent notation, and integer precision beyond 9007199254740992 cannot survive a round trip. Transmit values as strings when the exact text matters.

Why did one of my keys disappear?

Your object had the same key twice. RFC 8259 leaves duplicate-key behavior undefined; JavaScript keeps only the last value. The formatter shows what any JS consumer of the payload would see.

If the JSON is tabular — an array of flat records — the JSON to CSV converter turns it into a spreadsheet-ready file; the JWT decoder handles Base64-wrapped JSON tokens.