Validate, pretty print, minify and sort keys. Client-side only.
What it's for
Make JSON readable, squeeze it onto one line, or find exactly where it is broken. JSON is the text format apps and websites use to pass data around, written with curly brackets and quotes.
Before you start
Have the JSON you were given — by an app, a website, a developer or a file — ready to paste. It stays in your browser and is never uploaded.
Paste your JSON
Paste it into Document, replacing the sample that is there.
Choose what to do with it
Press Format to lay it out neatly over many lines, Minify to squeeze it onto one line to save space, or Validate just to check that it is correct.
Set the layout, if formatting
With Format, choose how far each level is pushed in under Indent; leave it on 2 spaces unless you were told otherwise. Turn on Sort keys to put the field names in A to Z order — the data itself does not change.
Show the result and copy it
Press Show the result to bring the answer into view; it has been updating as you type. Press Copy to take it.
Fix any mistake it points to
If the JSON is broken, a box under the document gives the line and column, prints that line, and puts a ^ under the exact character. Fix it in Document and the answer comes back.
Reading the result
If it goes wrong
Validate a document, pretty print it at the indent you want, minify it for the wire, or sort every object's keys so two versions of the same file can be compared.
The document is parsed here rather than handed to the browser's own JSON reader, for three reasons. The browser's parser does not tell you reliably WHERE an error is — the wording and the position differ between Chrome, Safari and Firefox — so it could not point at a line. It turns every number into a floating-point value, which rounds long ids and drops trailing zeroes, corrupting a document you only asked to tidy. And it silently discards duplicate property names, which is the exact kind of quiet wrongness worth catching.
Strings are the one thing rewritten rather than preserved: A becomes A. That changes the bytes but not the value, so nothing is lost — unlike a number, where the two really would differ.
The page gives the line and the column, prints the offending line, and puts a caret under the character that broke it. Most JSON errors are a missing comma, a trailing comma or an unclosed brace, and all three are invisible until something points at them.
Because JSON does not allow one, even though JavaScript, Python and most config formats do. This is the single most common JSON error. JSON5 and JSONC allow trailing commas and comments — if your file has either, it is not JSON, whatever the extension says.
No, and that is deliberate. Most formatters parse a number into a float and write the float back, which silently rounds a long id — 1234567890123456789 becomes 1234567890123456800 — and turns 1.0 into 1. This keeps every number exactly as you wrote it, digit for digit.
JSON does not forbid the same property name twice in one object, and nearly every parser silently keeps the last one. So {"amount": 500, "amount": 50} is a valid document that quietly becomes 50. This finds them, tells you the line, and keeps both — a formatter should never be the thing that deleted a line of your data.
No. Property order is not significant in JSON, so a sorted object is the same object. Array order IS significant and is never touched. Sorting is by character code rather than by locale, so the same file sorts the same way on every machine — a sorted file that still shows a diff would defeat the point.
No. The parser is JavaScript running in this tab, and no request carrying your document is ever made. That matters here more than on most pages, because the JSON people paste into a formatter is very often a real API response with real customer records in it.
All three are legal JavaScript and none is legal JSON. Each is named for what it is rather than reported as an unexpected token.
A double holds about 15 significant digits. Anything longer — a Twitter id, a Snowflake, a bank reference — comes back wrong from a formatter that round-trips through a float.
Important
Documents are parsed strictly to RFC 8259. JSON5 and JSONC — comments, trailing commas, unquoted keys — are reported as errors rather than accepted. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.