U.UtilityApp
🔄 ConvertersFree · No signup

JSON Formatter & Validator

Format, beautify and validate JSON with proper indentation and instant error messages. Paste minified JSON and get clean, readable output.

What formatting changes besides whitespace

The formatter reads the whole document into memory and prints it again with two-space indentation. Because it rebuilds the document rather than re-indenting text, a few details can change:

  • Numbers are written in their shortest form. 1.50 becomes 1.5, 1e3 becomes 1000, 1.0E-7 becomes 1e-7, and -0 becomes 0.
  • Escapes are resolved. \u00e9 is shown as é and \/ as a plain /. Quotes, backslashes and control characters keep their escapes.
  • Duplicate keys collapse silently. {"a":1,"a":2} comes out with only "a": 2, with no warning that the first value was dropped.

Large IDs lose precision

Numbers are read as standard double-precision values, so integers beyond 9007199254740991 are rounded:

{"id": 12345678901234567890} → "id": 12345678901234567000

The output looks valid, which makes this easy to miss. Order numbers and database keys of 16 digits or more are the usual victims. If you need to keep such values exactly, they should be sent as strings. Don't copy formatted output back into a system as the source of truth for those fields.

Key order can shift

Keys normally stay in the order you wrote them, with one exception. Keys that look like whole numbers move to the front in ascending order:

{"b":1,"10":"x","2":"y","a":2} → "2", "10", "b", "a"

The data is the same, since JSON objects have no defined order, but a diff against the original will show moved lines. Keep that in mind when you format two versions of a file to compare them.

What it accepts as one document

Any single JSON value works, including a bare string or number such as 42. Two values one after the other do not, so JSON Lines files and log extracts with one object per line fail with an error. Format those one line at a time.

Error messages come from your browser's own JSON parser, so the wording differs between browsers. Most include a position or a line and column that points close to the problem. For the reverse job, stripping the whitespace back out, use the JSON Minifier.

Frequently asked questions

Can I change the indentation to four spaces or tabs?+

No. Indentation is fixed at two spaces for each nesting level. Most code editors can re-indent the result if your project uses a different style.

Does formatting change my data?+

The values stay equal in meaning, with two exceptions to watch for: very large integers get rounded and duplicate keys are reduced to the last one. Everything else is a change of layout or notation.

Is my JSON uploaded to a server?+

No. Parsing and formatting run in your browser, so API responses and configuration files with secrets stay on your device.

Guides & deep dives

Embed this tool on your website

Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.

<iframe src="https://utilityapp.lat/embed/convert/json-formatter" title="JSON Formatter & Validator" width="100%" height="600" style="border:0;max-width:760px" loading="lazy"></iframe>
<p style="font-size:13px"><a href="https://utilityapp.lat/convert/json-formatter">JSON Formatter & Validator</a> by UtilityApp</p>