JSON Formatter

Beautify minified JSON with the indentation you prefer.

Preset Templates:
Indent Spacing:

JSON Raw Input

Formatted Output

What formatting does and does not change

Beautifying JSON re-serialises the parsed value with newlines and indentation. It never changes the data: the same keys, the same values, the same nesting come back out. What it does change is whitespace, and — because JavaScript objects preserve insertion order for string keys — the key order you get is the order the parser saw them in.

One consequence worth knowing: formatting normalises away things the original text may have had. Escaped Unicode like \u00e9 comes back as the literal character, numbers lose insignificant trailing zeros, and duplicate keys collapse to the last one that appeared. If you need the source preserved byte for byte, format a copy.

Indentation is a matter of house style rather than correctness. Two spaces is the most common default in JavaScript projects and keeps deeply nested structures from marching off the right edge; four is easier to scan at shallow depths; tabs let each reader pick their own width.

Frequently asked questions

Does formatting change my data?

No. The JSON is parsed and re-serialised, so keys, values, and nesting are identical. Only whitespace changes — though escaped Unicode is resolved to literal characters and duplicate keys collapse to the last occurrence.

Which indentation should I use?

Two spaces is the most common convention in JavaScript and keeps nested structures narrow. Four spaces reads more clearly at shallow depth. Tabs let each developer choose their own display width. None is more correct than the others.

Why did my key order change?

It should not have. JavaScript preserves insertion order for string keys, so the output order matches the input. Keys that look numeric are the exception — those are ordered numerically first, which is a language rule rather than a bug in this tool.

Can it format JSON with comments?

No. Comments are not valid JSON and the parser rejects them. Formats that allow them — JSONC, JSON5 — need a different parser; strip the comments first.

Is there a size limit?

No fixed limit. Formatting runs in your browser, so very large documents are bounded only by available memory.