JSON Formatter & Beautifier - Format JSON Online
Pretty-Print JSON
Paste minified or badly indented JSON on the left and a formatted, syntax-highlighted version appears on the right. Pick the indent width above the editor, then copy the result. A minified API response like this:
{"user":{"id":8812,"roles":["admin","billing"],"active":true},"next":null} becomes:
{
"user": {
"id": 8812,
"roles": [
"admin",
"billing"
],
"active": true
},
"next": null
} Why Exact Re-Indenting Matters
The quick way to format JSON in JavaScript is
JSON.stringify(JSON.parse(text), null, 2). It works for
most data, but it rounds integers above 253, so Twitter and
Discord snowflake IDs, 64-bit database keys and some order numbers
come out with the wrong last digits. It also rewrites
1.0 as 1 and 1e3 as
1000. This formatter only changes whitespace between
tokens, so what you copy out holds exactly the values you pasted in.
A byte-order mark at the start of the file, which some Windows editors
add, is removed.
Common Errors It Catches
- Trailing commas:
[1, 2, 3,]is fine in JavaScript but not in JSON. - Single quotes:
{'name': 'Ann'}needs double quotes. - Unquoted keys:
{name: "Ann"}is a JavaScript object literal, not JSON. - Python output:
True,FalseandNonemust betrue,falseandnull.
For line-by-line error details use the JSON validator. To collapse and explore a large document, open it in the JSON tree viewer, and to compare two versions use JSON diff.
Related Tools
JSON Validator
Validate JSON syntax and get clear, human-readable error messages.
JSON Minifier
Minify JSON by removing all unnecessary whitespace for smaller payloads.
JSON Tree Viewer
Visualise JSON as a collapsible tree to explore deeply nested structures.
JSON Path Finder
Click any value in a JSON document to get its path expression.