Runs in this tab. A token, a key, a config — whatever you paste stays local.
Loading the tool…
Free Online JSON Formatter and Validator
How it works
What RFC 8259 actually allows
JSON is a much smaller language than the JavaScript object literal it looks like. RFC 8259 permits no comments, no trailing commas and no single quotes, and every key must be a double-quoted string. Most 'invalid JSON' is one of those four things, which is why the error message names a line and a column rather than saying the document is bad.
- Trailing commas
- Not valid JSON. [1, 2,] is fine in JavaScript source and fails JSON.parse.
- Comments
- // and /* */ are not part of JSON. JSONC and JSON5 are separate formats with separate parsers.
- Quoting
- Double quotes only, on keys and on string values. Single quotes are a syntax error.
- Numbers
- IEEE 754 doubles. An integer above 2^53 loses precision on the round trip — a Twitter-style 64-bit id needs to be a string.
- Indent
- Two spaces, four spaces or tabs on output. Minifying strips every byte of insignificant whitespace.
How to use it
How to format and validate JSON online
- 01
Paste the JSON
A whole API response, a config file, or a single log line.
- 02
Fix what the error points at
Failures report the line and column of the offending token, not just that parsing failed.
- 03
Choose pretty or minified
Indent it to read it, or minify it to paste into a request body.
Where it earns its keep
Where formatting JSON is the job
- Reading a one-line API response that arrived with no whitespace at all.
- Checking a package.json or tsconfig.json before a build fails on it.
- Pulling a JSON blob out of a log line to see what a service actually sent.
- Minifying a payload before pasting it into a curl command or a test fixture.
Questions
JSON Formatter, answered
Can it repair broken JSON automatically?
No, and deliberately not. It tells you where the parse failed and leaves the fix to you — a formatter that guesses at a missing brace can produce a document that parses cleanly and means something different from what you intended.
Is my JSON sent to a server?
No. Parsing and formatting happen in this browser tab. Open your network inspector while you paste — no request carries the document, which is why the tool keeps working with the network off.
What happens to duplicate keys?
RFC 8259 calls the behaviour undefined and JavaScript's parser keeps the last one, so {"a":1,"a":2} formats as {"a":2}. If duplicate keys matter to you, the formatter is the wrong place to detect them.
Why did my large integer change?
JSON numbers are parsed as doubles, so anything above 9007199254740991 is rounded. That is a property of the format, not a bug in the tool — systems that need exact 64-bit ids send them as strings.