JSON Beautifier
Beautify or pretty print JSON in the browser. Indentation and line breaks are added and nothing else is changed — including the number you did not expect to be watched.
Ctrl / Cmd + Enter formats as well.
Click any { } or [ ] to collapse or expand it. The number beside a bracket is its item count, so an empty array is obvious at a glance. Rendering stops at 5,000 nodes.
Paste JSON into the Format & validate tab first.
Supported: $, .key, ..key (recursive descent), [0] and [*]. That is the subset developers actually use, not the whole JSONPath grammar.
Compared structurally, not as text. Indentation, key order and 1.0 vs 1 are not reported as differences.
The data comes from the input box on the Format & validate tab. Supported: type, required, properties, items, enum, const, numeric bounds, string length and pattern, array length and uniqueness, and additionalProperties. Not supported yet: $ref, allOf/anyOf/oneOf and format.
Beautify, pretty print, format, prettify, indent: these are the same operation, and a site that has a different page for each name is chasing keywords, not offering features. This page and the formatter page run identical code, so the output is identical too.
What "beautify" can quietly do to your data is the part worth reading before you paste a production payload in. The rules are on the formatter page and they apply here unchanged: whitespace is added, and integers outside ±(2^53 − 1) can lose digits on the way through.
What beautifying changes, precisely
Beautifying is parse, then re-serialise. That means the output is guaranteed to differ from the input in exactly the ways a parser and serialiser introduce, and nothing else:
- Added: newlines and indentation.
- Removed: all insignificant whitespace, including inside strings? No — whitespace inside a string is data and is preserved. Only whitespace between tokens goes.
- Normalised: number literals are rewritten through the engine's double
representation, so
1.0becomes1,1e2becomes100, and1.5e21becomes1.5e+21. - Collapsed: duplicate keys, last one wins.
- Reordered: named keys keep the order in your file unless you tick Sort keys; integer-like keys always move to the front, ascending, because that is how a JavaScript object stores them. Object order carries no meaning in JSON, so sorting is safe; array order does, so it is never touched.
Doing the same thing in a terminal
# Python
python3 -m json.tool in.json out.json
# jq
jq . in.json > out.json
# Node
node -e 'const f=require("fs"),p=process.argv[1];
f.writeFileSync(p, JSON.stringify(JSON.parse(f.readFileSync(p,"utf8")),null,2))' in.json
All three are faster than a web page for a file that is already on disk, and two of them give you an exit code, which is what CI needs. The page wins when the JSON is in a clipboard, when you want to look at the structure rather than read it, or when the file is large enough that opening it in an editor is the mistake.
Frequently asked questions
Will beautifying change my values?
Strings and structure, no. Numbers, possibly: integers outside ±(2^53 − 1) can lose digits, large magnitudes switch to exponent form, and duplicate keys collapse to the last occurrence. If exact numbers matter, send them as strings.
Is beautify different from format?
No. Same operation, same output. Treat "beautifier", "pretty printer", "prettifier" and "formatter" as synonyms — on this site they literally share one implementation.
Why did my file get bigger after beautifying?
Because it was minified, and indentation is bytes. A 2-space pretty print of a repetitive payload typically grows around 65% relative to the minified form — the inverse of the ~40% a minifier saves. Store and transmit minified; read pretty.
Can it do a batch of files?
No — the page has no filesystem access beyond the files you drop on it, and dropping fifty files to have them processed one at a time is a worse answer than a two-line script. Use python -m json.tool in a loop.