Output will appear here
Output will appear here
Paste JSON on the left and this formatter pretty prints it on the right, re-indented with 2 or 4 spaces. It parses the input with the browser's own JSON.parse and writes it back out with JSON.stringify, so the result is always valid JSON. If the input is broken you get the parser's error message instead. A Minify toggle reverses the process.
By Ankit Aglawe · Updated · Runs entirely in your browser
One long line becomes one key per line, nested objects and arrays indented a level each. Key order, values and null are kept as they were. The page examples use 2 spaces; the tool defaults to 4.
{"id":4127,"number":88,"title":"Login button unresponsive on Safari","state":"open","user":{"login":"dev-sam","site_admin":false},"labels":[{"name":"bug","color":"d73a4a"},{"name":"browser:safari","color":"0e8a16"}],"assignee":null,"comments":3}{
"id": 4127,
"number": 88,
"title": "Login button unresponsive on Safari",
"state": "open",
"user": {
"login": "dev-sam",
"site_admin": false
},
"labels": [
{
"name": "bug",
"color": "d73a4a"
},
{
"name": "browser:safari",
"color": "0e8a16"
}
],
"assignee": null,
"comments": 3
}Escapes are decoded: \u00e9 prints as é, \u2713 as a check mark, and \/ as a plain /. The data is the same, only the spelling changes. Note also that "200" and "404" move ahead of "total": JavaScript objects list integer-like keys first, in numeric order.
{"msg":"Caf\u00e9 order \u2713","url":"https:\/\/shop.example.test\/o\/91","byStatus":{"total":16,"404":2,"200":14}}{
"msg": "Café order ✓",
"url": "https://shop.example.test/o/91",
"byStatus": {
"200": 14,
"404": 2,
"total": 16
}
}JSON allows the same key twice but does not say which wins. JSON.parse keeps the last one, so {"retry": 3, "retry": 5} is formatted as {"retry": 5} with no warning. If you suspect duplicates, check the raw input before trusting the pretty version.
Values go through JavaScript numbers. 1.0 prints as 1, 1e3 as 1000, -0 as 0, and integers past 2^53 lose precision: 9007199254740993 comes out as 9007199254740992. If exact ids matter, keep them as strings in the source.
Keys such as "1" or "404" are listed before other keys, in ascending order, because that is how JavaScript orders object properties. Every other key keeps its original position. The formatter has no key sorting option.
These are not JSON, so the formatter refuses them rather than guessing. [1,2,], // comments, NaN, Infinity and single-quoted strings each produce a parse error. Use the JSON Validator page to read what the error means.
A file saved as "UTF-8 with BOM" starts with an invisible U+FEFF. JSON.parse treats it as an unexpected token, so the input fails even though it looks fine. Re-save the file as plain UTF-8 or delete the first character.
The dropdown offers 2 spaces and 4 spaces. The third option, labelled Tab, currently indents with 8 spaces rather than a tab character, so do not rely on it for tab-indented files.
| Tool | Output | Use it when |
|---|---|---|
| Formatter / beautifier | Indented JSON, one key per line | Reading or reviewing a payload |
| Minifier | Same data on one line, no whitespace | Shipping or embedding JSON |
| Validator | Pass, or the parser error with line and column | Finding why a parse fails |
Enter minified, compact, or messy JSON in the editor. The formatter accepts valid JSON of any size and structure.
Select 2-space, 4-space, or tab indentation from the toolbar. The JSON is reformatted in real time as you change the setting.
Click Copy to grab the perfectly indented JSON, or download it as a .json file with your chosen formatting applied.
Paste it into the left pane. The indented version appears on the right straight away. Pick 2 or 4 spaces, then copy or download it as formatted.json.
Yes. Beautify, pretty print and format all mean the same thing: add line breaks and indentation without changing the data. This page does all three.
The values stay the same, but the text can change: escapes like \u00e9 are decoded, 1.0 becomes 1, a duplicated key keeps only its last value, and integers above 2^53 are rounded.
No. Those are JSONC or JSON5, not JSON, and the formatter reports a parse error. Remove them, or paste into one of the code generators, which strips comments and trailing commas before converting.
Use jq . file.json or python3 -m json.tool file.json. This page is quicker for a one-off paste and gives the same layout.
No. Parsing and formatting run in JavaScript in your browser tab. Nothing is sent to a server.
Need several formats at once? Convert All shows every output from one paste. Or browse all JSON converters.