Free JSON Pretty Print Tool
Make JSON easy to read by re-indenting it with consistent spacing. Values stay exactly the same and only the layout changes, with 2 spaces by default and a 4-space option, free, with nothing uploaded anywhere.
Formatted JSON
Your input never leaves this device — the conversion runs entirely in your browser.
What this tool does
This tool re-indents JSON so its structure is easy to see. Nested objects and arrays are laid out one value per line, with consistent indentation showing how deep each value sits. The result is the same JSON, arranged for human reading.
Only the layout changes. Values are not changed, keys are not added or removed, and no data is dropped. The tool uses 2 spaces of indentation by default, with a 4-space option for readers who prefer wider indents. Choose the width that reads best for you; the data is identical either way.
Validation happens as a side effect. To re-indent the input, the tool must first parse it, so invalid JSON is reported as an error instead of producing output. That makes this tool a quick way to check JSON while making it readable, but its job is layout, not repair.
The work runs entirely in your browser. Your input never leaves your device, nothing is uploaded, and there is no sign-up. The tool is free for any JSON you paste in.
How to use the JSON pretty print tool
Pretty printing takes a few simple steps. No installation is needed.
- Paste your JSON into the input area, however it is currently spaced, including JSON pasted as a single long line.
- Choose 2-space or 4-space indentation. The default is 2 spaces, which suits most reading.
- Start the formatting. If the JSON is invalid, the tool reports the problem so you can fix the input.
- Read the indented result, or copy it for use elsewhere. The values are unchanged, so the output can be used anywhere the original was valid.
Keep the original if you need the compact form. Pretty printed JSON is larger because of the added spacing, so it suits reading and editing, not saving space.
Worked example
The input below is valid JSON with uneven spacing. Some lines are crowded together, and the indentation does not match the nesting.
{
"name": "Café Luna",
"city": "Lisbon", "rating": 4.7,
"open": true, "website": null,
"address": {"street": "Rua Nova 12",
"postcode": "1100-123"},
"tags": ["café", "bakery"]
}With 2-space indentation, the same values come back evenly laid out. Compare the two blocks: every key and value is identical, and only the spacing has changed.
{
"name": "Café Luna",
"city": "Lisbon",
"rating": 4.7,
"open": true,
"website": null,
"address": {
"street": "Rua Nova 12",
"postcode": "1100-123"
},
"tags": [
"café",
"bakery"
]
}With 4 spaces, the nesting is wider but the values stay the same. Either width is valid JSON, and either can be pasted back wherever JSON is accepted.
Rules and edge cases
Input must be valid JSON. Trailing commas, single quotes, unquoted keys and comments are not valid JSON, so the tool reports an error rather than guessing what was meant. Fix the reported problem in the input and format again.
If the same key appears twice in one object, only the last value appears in the output, because parsing keeps the last value. Empty objects and empty arrays stay compact: they print as {} and [] rather than spreading over several lines.
Number and string spellings may be normalised in the output while the values stay the same. For example, the number written as 1.0 may print as 1, because both spellings hold the same numeric value. Keys are not sorted, and no keys are added or removed.
Any valid JSON value can be formatted, including a single number, string, boolean or null, although such values have no nesting to lay out. Very large inputs may be slow, because the whole result is built in your browser.
Common mistakes
Most problems come from expecting the formatter to do more than lay out valid JSON. The cases below cover the misunderstandings seen most often.
- Expecting pretty printing to fix invalid JSON. It reports errors; it does not repair missing commas, brackets or quotes.
- Expecting keys to be sorted alphabetically. Pretty printing only changes spacing, and key order is left alone.
- Expecting fields to be removed or shortened. No values are changed or dropped, so unwanted data must be removed by hand.
- Pasting JavaScript object code with single quotes or unquoted keys. That code may look like JSON but is not valid JSON, so it must be converted to strict JSON first.
- Expecting comments to survive. JSON has no comments, so any comment text makes the input invalid and must be removed first.
When to use pretty print, and when to choose something else
Use pretty printing whenever you need to read, check or edit JSON by eye: debugging a response, reviewing a configuration file, or finding a value in a long document. Even spacing turns a wall of text into a structure you can follow.
Use minifying when you need the smallest form, for example pasting JSON into a size-limited field or storing it compactly. Minified JSON is hard to read, so it suits machines and storage, not people. Use a validator when you only need a yes-or-no answer about validity, without a reformatted copy.
Use a diff tool when you need to compare two documents. Pretty printing alone can make two documents look similar while hiding a changed value, because layout says nothing about equality. Format for reading, and compare with a comparison tool.
Frequently asked questions
Does pretty printing change my values?
No. Only spacing and line breaks change. Every key and value stays the same, so the output holds exactly the data the input held, laid out for reading.
Should I use 2 spaces or 4 spaces?
Either is fine. The default is 2 spaces, which suits most reading. The 4-space option gives wider indents that some readers prefer. The data is identical at either width.
Does pretty printing sort the keys?
No. Keys are not sorted, added or removed. The tool only changes the layout, so keys stay in the order the parsed input holds them.
Does it fix invalid JSON?
No. Invalid JSON is reported as an error, not repaired. Fix the reported problem, such as a missing comma or bracket, and format the input again.
What happens with duplicate keys?
Only the last value for a repeated key appears in the output, because parsing keeps the last value. If the duplicates matter, fix the source data so each key appears once.
Can it format a single value, such as 42?
Yes. Any valid JSON value can be formatted, including a single number, string, boolean or null. Single values have no nesting, so the output is simply the value itself.
Is my data uploaded anywhere?
No. The formatting runs in your browser on your own device. Your input is never sent to a server, and there is no sign-up or account.



