Skip to content

JSON Formatter

Format and validate JSON. Runs entirely in your browser.

Input JSON

Paste your unformatted JSON here.

Formatted JSON

Result will appear here...

Pretty-printing is a round trip, and round trips change things

This formatter does not reflow your text. It parses the document into real values and then serialises those values back out with two-space indentation. The tidy output is a side effect of that round trip, which is worth understanding, because a round trip quietly normalises several things along the way.

Duplicate keys collapse. If an object contains the same key twice, the parser keeps the last one and the earlier value disappears from the output. That is standard behaviour, and it is usually the first sign that something upstream generated the document badly. Numbers are canonicalised too: 1.0 comes back as 1, 1e3 as 1000, and any precision beyond what a double can hold is gone before it reaches the output. Escaped characters resolve to the characters they denote, so a unicode escape becomes the literal symbol. Key order, on the other hand, is preserved exactly as written.

The parse step is the validator

Because formatting requires parsing, invalid input cannot produce output at all. You get the parser's own error, naming the position it gave up at, instead of a mangled document. That makes this a strict checker rather than a forgiving one, which catches a specific class of mistake: JSON has no comments, no trailing commas, no single-quoted strings, and no unquoted keys.

So a file that a code editor happily accepts may well be rejected here. VS Code settings files are JSONC, which allows comments. Some tooling accepts JSON5, which allows all of the above. Both look like JSON and neither is. A rejection is the formatter telling you the document would fail against a strict parser somewhere else, which is exactly what you want to find out before shipping it to an API.

What it deliberately does not do

There is no schema validation here: well-formed JSON with the wrong fields in it is still well-formed, and checking shape against a contract is a different job. There is no key sorting, because reordering keys changes a document that some consumers treat as ordered. And the output is always indented rather than minified, since the point of this page is reading a document, not shipping the smallest possible bytes.

Doing this locally matters more for JSON than for most formats. API responses, service-account credentials, webhook payloads and config files are where bearer tokens and secrets live, and pasting one into a remote formatter hands it over. Here the document is parsed by your own browser's JSON parser and never becomes a network request.

JSON Formatter FAQ

Does this tell me if my JSON has a syntax error?

Yes. The formatter parses your input before pretty-printing it, so invalid JSON (a trailing comma, an unquoted key, a missing bracket) is reported instead of silently producing garbled output.

Is there a size limit on the JSON I can format?

No server-imposed limit. Parsing and formatting happen in your browser's own memory, so very large JSON documents are limited only by your device, not by an upload cap.

Does formatting JSON here send my data anywhere?

No. The JSON never leaves your browser tab. There's no network request involved in parsing or formatting it, which matters if you're working with API keys, internal config, or other data you'd rather not paste into a random web form.