JSON Formatter and Viewer Online
Minified JSON saves bytes on the wire, but it is miserable to read: one long line with no line breaks, where nested objects and arrays run together. This formatter re-indents that string into a clean, hierarchical layout so you can actually see the structure — which keys belong to which object, how deeply arrays nest, and where a value sits in the tree.
It also doubles as a quick validity check. Well-formed JSON reformats instantly; malformed JSON stops at the first problem, so a trailing comma, a single-quoted string, or an unquoted key surfaces right where it breaks. Everything runs in your browser — the JSON you paste never leaves your machine, which matters when it is an API response or config that contains secrets.
How to use it
- Paste your JSON — minified, messy, or already partly formatted — into the input.
- Choose an indentation width (2 or 4 spaces) to match your project's style.
- Read the formatted output, using the indentation to trace nested objects and arrays.
- If the input is invalid, note where formatting stops and fix the syntax there.
Common use cases
- Reformat a minified or messy JSON blob into indented, readable form.
- Pretty-print an API response so you can scan its structure quickly.
- Catch a syntax error by seeing where the formatting breaks.
Examples
Minified object to readable form
Input {"id":42,"tags":["a","b"],"ok":true}
Output {
"id": 42,
"tags": [
"a",
"b"
],
"ok": true
}
Each key lands on its own line, and the array elements indent one level deeper.
Spotting an error
Input {"name": "Ada", "age": 36,}
Output Invalid JSON: trailing comma before }
JSON forbids a comma after the last property; remove it and the object formats cleanly.
Frequently asked questions
- Is my JSON uploaded to a server?
- No. Formatting happens entirely in your browser, so the data never leaves your device — safe for API payloads and config with secrets.
- Should I use 2 or 4 spaces?
- Either is valid — pick what your codebase uses. Two spaces keeps deeply nested JSON narrower; four makes shallow structures easier to scan.
- Why does formatting fail on my input?
- The input is not valid JSON. Common causes are trailing commas, single quotes instead of double, unquoted keys, or a missing bracket. The output points to where parsing broke.
- Does prettifying change my data?
- No. It only adds whitespace and line breaks. The keys, values, and structure are identical — just laid out for humans to read.
Related tools
-
XML Formatter Online
Format and prettify XML online with readable indentation for documents, feeds, configs, and API responses.
-
YAML Formatter and Viewer Online
Format, prettify, and inspect YAML online with readable indentation for configs, manifests, and DevOps files.
-
SQL Formatter Online
Format and prettify SQL queries online across common SQL dialects for easier reading and debugging.
-
JSON Minifier Online
Minify JSON online by removing whitespace and formatting overhead for compact API payloads and configuration files.