Developer guide
Pretty print JSON for easier reading
Pretty printing turns compact JSON into indented text so nested structures are easier to review.
The problem
It is useful for reviewing payloads, checking documentation examples, and cleaning up JSON copied from logs or browser tools.
Example
{"user":{"id":7,"roles":["admin","editor"]},"ok":true}
{
"user": {
"id": 7,
"roles": [
"admin",
"editor"
]
},
"ok": true
}
How to fix it
- Paste the full JSON value into the formatter.
- Run Format JSON to add indentation and line breaks.
- Copy the result into notes, tickets, docs, or a code review when readability matters.
Readable JSON for reviews
Pretty printing helps when you need to compare fields, review a nested error, or paste a payload into a ticket. The structure becomes easier to scan because arrays and objects get their own lines.
Keep a compact copy only when the destination requires it. For discussion, debugging, and documentation, the indented version usually saves time.
Common mistakes
- Trying to pretty print invalid JSON
- Including log prefixes before the JSON value
- Using comments or trailing commas from JavaScript examples
- Copying only part of a nested object
Related problems
FAQ
What indentation does the formatter use?
It uses two spaces, a common default for readable JSON snippets.
Can I pretty print a JSON array?
Yes. Objects, arrays, strings, numbers, booleans, and null are all valid JSON values.
Is pretty-printed JSON larger?
Yes, because it includes whitespace. Use Minify when you need compact output.