JSON Beautifier
Pretty-print JSON with 2, 3, 4-space or tab indentation. Turn a single-line payload into structure you can actually read.
From one line to readable structure
APIs, logs and databases hand you JSON as a single dense line — correct for machines, hopeless for eyes. Beautifying (also called pretty-printing) re-indents the document so nesting becomes visible: each level steps in, each key gets its own line, arrays unfold vertically. Paste, press Beautify (or Ctrl+Enter), read.
2 spaces, 4 spaces, or tabs?
Pure convention — the data is identical. 2 spaces is the dominant style in the web world (npm, most APIs, Prettier's default for JSON) and keeps deep nesting compact. 4 spaces reads more airily and suits documentation and configuration files. Tabs let every reader choose their own width in their editor. If a team style guide exists, follow it; if not, 2 spaces is the safe default — and switching later is one click here.
Beautified JSON and version control
One underrated payoff: diffs. A one-line JSON blob makes every change look like the whole file changed; pretty-printed JSON turns edits into clean, reviewable line-level diffs. That is why committed fixtures, config files and API snapshots should always be formatted — and if key order also jumps around between exports, run it through the JSON Sorter first for fully stable, canonical files.
Frequently asked questions
Is beautifying the same as formatting?
Yes — beautify, pretty-print and format all describe the same operation: re-indenting JSON for readability without changing the data. The reverse operation (removing whitespace) is minifying.
Does pretty-printing change how my JSON parses?
No. Whitespace between JSON tokens carries no meaning, so parsers read the beautified and minified versions identically. Only whitespace inside string values matters, and that is never touched.
Why do my numbers look different after beautifying?
The output is regenerated from the parsed values, so equivalent spellings normalize: 1.50e1 becomes 15, leading plus signs and redundant zeros disappear. The numeric values are unchanged; only their textual form is canonical.
Can I beautify JSON with comments or trailing commas?
Not directly — those are not valid JSON, so the beautifier reports the error and its position. Use Repair on the main JSON Formatter page first; it strips comments and fixes trailing commas, then beautifying works.
What indentation should I use for package.json and config files?
The ecosystem convention is 2 spaces — npm itself writes package.json with 2 spaces. Matching the tool that owns the file avoids noisy diffs when it rewrites the file later.