Make JSON readable in one click
APIs, log files and configuration exports often deliver JSON on a single line. A JSON formatter (also called a JSON beautifier or pretty printer) adds line breaks and indentation so you can see the structure: which objects are nested inside which, how long arrays are, and where a value lives. The data itself is not changed — only whitespace is added.
Formatting also validates the document. If a comma is missing, a string uses single quotes, or there is a trailing comma, the formatter stops and shows a precise message such as Expected ',' or '}' after property value (line 4, column 12) with a caret under the problem character.
Options
- 2 spaces – the most common style (used by npm, Prettier and most APIs).
- 4 spaces – common in Python and Java projects.
- Tabs – lets each editor decide the visual width.
- Minify – removes all optional whitespace for the smallest payload.
- Sort keys A→Z – sorts object keys recursively, which makes two documents much easier to compare or review in a diff.
Example
Input
{"name":"Asha","roles":["admin","dev"],"active":true}Formatted
{
"name": "Asha",
"roles": [
"admin",
"dev"
],
"active": true
}Common JSON syntax errors
| Problem | Wrong | Right |
|---|---|---|
| Trailing comma | [1, 2,] | [1, 2] |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comments | {"a": 1 // note} | JSON does not allow comments |
| Special numbers | NaN, Infinity, undefined | use null or a string |
Frequently asked questions
Does formatting change my data?
No. Only whitespace is added or removed. Key order is preserved unless you enable “Sort keys”.
What is the difference between the formatter and the validator?
Both parse the JSON. The formatter focuses on producing readable output; the validator focuses on the result of the check and shows statistics such as depth and key count.
Can I format very large JSON files?
Yes. Everything runs locally, so multi-megabyte files work. For inputs over about 2 MB, live formatting pauses and you press Format manually.
Is my data private?
Yes. The JSON never leaves your browser.