JSON · Runs in your browser

Format, minify and validate JSON

Paste JSON or choose a UTF-8 file, check its syntax, then indent it or take out the whitespace between values, and copy or download the result. Numbers stay as they were written, large integers included; so do the order of the keys and the spaces inside strings. Duplicate keys are reported and kept.

Up to 1 MiB at a time, processed in this browser only

Standard JSON only: comments, single quotes and trailing commas are not repaired. A file has to be UTF-8; a BOM at its start is removed when formatting or minifying.

2 spaces

Numbers stay as they were written

The JSON is never turned into a JavaScript object and written out again. 900719925474099312345, 1.2300e+5 and -0 come out of formatting or minifying as they went in.

Only the whitespace between values changes

Minifying takes out the spaces, line breaks and tabs outside strings. Two spaces inside a string, an escape or a URL stay as they are. Keys are not sorted and duplicate keys are not merged.

Change something, then run it again

When the source or the indent changes, the old result is dropped. What you download is this result; your file is not overwritten. The page keeps nothing: reload it and the text is gone.

Questions about formatting JSON

What do I do when formatting reports an error?

Go to the line and column in the message and check the double quotes, commas, colons and brackets. Standard JSON has no comments, single quotes, undefined or NaN, and a trailing comma is an error too. The source is never changed for you.

Are large integers rounded?

No. A number is kept as it was written and never becomes a JavaScript Number. The program that reads the JSON next may still read it as floating point; whether an identifier should be a quoted string is for whoever produces the data to decide.

Does minifying remove spaces inside strings?

No. Only the whitespace between values goes. Spaces, escaped line breaks and double slashes inside a string stay as they are.

Why does JSON with duplicate keys pass validation?

The JSON grammar allows a name to appear twice, but programs do not agree on what that means. This tool says how many there are and keeps their order and values; correct them by your own rules.

More than tools

Is there a PDF to read as well?

Doc2X translates a PDF and keeps its layout, converts it to Markdown, LaTeX, Word or Typst with the formulas and tables intact, and answers questions about it with the page each answer comes from. The free plan covers about 100 pages a month.

Open the workbench