JSON Formatter, Validator & Minifier
Paste JSON and it is reformatted as you type. If it will not parse you get the line and column where the parser gave up, which is usually a few characters after the actual mistake. Valid input also gets checked for the two problems that parse fine and still hurt: duplicate keys and integers too big for JavaScript.
Two spaces is the default in most style guides. Minify for anything going over the wire.
Formatting is a round trip, not a cosmetic pass
This tool does not add line breaks to your text. It parses the JSON into a value and prints that value again. Everything that was not part of the data is gone on the way through, which is mostly what you want and occasionally a surprise.
- Comments disappear — because they never parsed in the first place. JSON has no comments, so a file with them is not JSON and you get an error instead.
- Numbers get normalised.
1.0comes back as1,1e3as1000,0.30000000000000004as itself. The written form is not preserved, only the value. - Keys that look like array indices move.
{"2":"b","1":"a"}reprints as{"1":"a","2":"b"}. That is a JavaScript object rule, not a JSON one, and it is the one reordering you cannot turn off here. - Escapes are rewritten.
\u0041becomesA, and a literal tab inside a string becomes\t.
The entire grammar, in one list
JSON is deliberately tiny, which is why so many things that look like JSON are not. The complete list of what is allowed: objects, arrays, strings in double quotes, numbers, true, false, null. That is all. Specifically rejected:
- Trailing commas after the last element or member.
- Single-quoted strings, and unquoted object keys.
//and/* */comments.NaN,Infinity, hex numbers, leading zeros, and a leading+.- A number with a bare decimal point on either side:
.5and5.are both invalid,0.5and5.0are fine.
Since RFC 8259 the top level can be any value, not just an object or array, so a document containing only 42 is valid JSON. Older parsers disagree. If you are generating output for something ancient, wrap it.
Numbers are where JSON quietly lies
The specification puts no limit on the size or precision of a number. JavaScript does: every number is a 64-bit float, so integers above 9,007,199,254,740,991 cannot all be represented. Parse 9007199254740993 and you get 9007199254740992 back, with no error anywhere.
This bites hardest with identifiers. Database IDs, Discord snowflakes and timestamps in nanoseconds routinely cross that line, which is why well-designed APIs send large IDs as strings. The tool scans your input for integer literals that change when JavaScript reads them and tells you which ones. It cannot fix them — by the time the value exists, the digits are gone. If you see that warning, treat the formatted output as unsafe to paste back into anything that matters.
Duplicate keys parse fine and mean nothing
RFC 8259 says object names SHOULD be unique and leaves the behaviour undefined when they are not. In practice JavaScript keeps the last one, Python keeps the last one, and some Go and Java configurations raise an error. A config file with "timeout" twice is therefore a real bug that most tools will never mention. This one reads the raw text before parsing throws the evidence away, and lists any key it sees twice in the same object.
Where this stops working
It validates syntax, not meaning. Valid JSON that is missing a field your service requires still passes here — for that you need a JSON Schema validator, which this is not.
It will not read the near-miss formats. JSON5 and JSONC, which allow comments and trailing commas, both fail. NDJSON — one object per line, no wrapping array — fails too, because the second line is unexpected input. Delete the offending characters or wrap the lines in an array yourself.
And it all runs on the page's main thread. A few megabytes is comfortable. Somewhere above that the tab stops responding while it works, and a very large file can exhaust memory outright. If your JSON came from a database export, use a streaming parser on your own machine rather than a browser tab.
Frequently asked questions
Is my JSON uploaded anywhere?
No. The parsing, formatting and scanning all happen in this tab using the browser’s own JSON parser. Nothing is transmitted and nothing is stored, so reloading the page loses your input.
Why does the error point at the wrong character?
Because a parser only notices a problem when it reaches something that cannot possibly come next. A missing comma is usually reported at the start of the following key, and an unclosed string is reported wherever the next quote happens to be. Look just before the position it gives you.
Can I format JSON that has comments in it?
Not as it stands. Comments make the file JSONC or JSON5, not JSON, and the parser rejects them. Strip the comment lines first, or use the format your editor or config loader actually expects.
Does sorting the keys change the data?
No, object members are unordered by definition, so sorting produces an equivalent document. It is worth doing before a diff and worth avoiding in files people read, where the author’s grouping usually carries meaning.
What is the largest file this handles?
A few megabytes is fine on a normal machine. Past that the tab will freeze for seconds at a time, because formatting holds the original text, the parsed value and the output in memory at once. There is no hard cap, just a point where it stops being pleasant.
Last updated September 19, 2026