Pretty-print JSON with your choice of 2-space, 4-space or tab indentation, with optional alphabetical key sorting. Paste, format, copy — processed in your browser.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
What the formatter changes — and what it never touches
Minified or inconsistently indented JSON is unreadable the moment it nests three levels deep. The formatter parses your document and re-prints it with clean line breaks and the indentation you choose. Because it works on the parsed data, the output is guaranteed valid — and because only whitespace is added, every key, value and key order is untouched. The one optional transformation is alphabetical key sorting, useful before diffing.
Worked example
Input:
{"name":"Justwebworld","launched":2012,"topics":["tech","business"]}Output (2-space indent):
{
"name": "Justwebworld",
"launched": 2012,
"topics": [
"tech",
"business"
]
}When to use it
- Reading a minified API response during debugging.
- Normalizing config files to one indentation style before committing.
- Preparing JSON for a code review or documentation snippet.
- Combining with key sorting to produce canonical, diff-friendly output.
Limitations to know
- Numbers are printed in canonical form:
1.50becomes1.5— same value, normalized text. - Duplicate keys are resolved by the parser (last value wins) before formatting; run the Duplicate Key Finder first if that matters.
- Values over 15 digits can lose precision, as in every JavaScript-based tool — the formatter warns when it sees them.
Common errors and fixes
- “not valid JSON (line X, column Y)” — the input must parse before it can be formatted; the message points at the exact character to fix, or run the JSON Validator for the full diagnosis.
- Output loses my comments — standard JSON has no comments; files with
//are JSONC and will not parse.
How to use the JSON Formatter
- Paste your JSON into the input panel (or click "Load sample").
- Choose the indentation — 2 spaces, 4 spaces or tabs — and optionally tick "Sort keys alphabetically".
- Click "Format JSON".
- Copy the formatted result or download it as a .json file.
Frequently asked questions
What does formatting (beautifying) JSON do?
It re-serializes the data with line breaks and consistent indentation so humans can read it. Only whitespace changes — every key, value and (unless you enable sorting) the key order stays exactly as it was.
Does formatting change my data?
No. The document is parsed and re-printed, so values are byte-identical. The one intentional transformation is optional alphabetical key sorting, which changes key order but never values.
Why do my numbers look different after formatting?
JavaScript-based formatters print numbers in canonical form: 1.50 becomes 1.5 and 1e2 becomes 100. The numeric value is identical; only the textual representation is normalized. Numbers over 15 digits can lose precision — the tool warns when it sees them.
Tabs or spaces for JSON?
Two spaces is the most common convention (npm, most style guides); four spaces reads better in deep nesting; tabs make files smaller and respect each reader's editor settings. All three are valid JSON — pick what your team already uses.