What is a JSON formatter?
JSON (JavaScript Object Notation) is the most common format for exchanging data between web services, apps and configuration files. Machines produce it as a single compact line, which is efficient but almost impossible for a person to read. A JSON formatter, also called a beautifier or pretty-printer, adds line breaks and indentation so the structure of objects and arrays is obvious at a glance.
This tool also works the other way: minify strips every unnecessary space to make the payload as small as possible. And it is a strict validator. If the JSON is broken, you get a plain-language explanation such as “Trailing comma before } is not allowed” with the line and column, plus a button that jumps straight to the problem.
How to use it
- Paste your JSON into the input box. It is formatted and checked as you type.
- Choose Beautify or Minify, and the indentation you prefer.
- Tick Sort keys A–Z to order object keys alphabetically at every level, which makes two documents easier to compare.
- Copy the result or download it as a
.jsonfile. If the JSON is invalid, click Go to error.
Common JSON errors
- Trailing commas:
[1, 2,]is valid in JavaScript but not in JSON. - Single quotes: strings and keys must use double quotes:
{"a": "b"}, not{'a': 'b'}. - Unquoted keys:
{a: 1}must be written{"a": 1}. - Comments: JSON has no comments. Remove
//and/* */lines. - Leading zeros and special values:
007,NaN,Infinityandundefinedare not allowed. - Raw line breaks inside strings: use
\ninstead.
Example
The compact input {"name":"ToolNook","tools":53,"free":true} becomes:
{
"name": "ToolNook",
"tools": 53,
"free": true
}
More worked examples
Common error: {"a": 1, "b": 2,} fails at line 1, column 17 with “Trailing comma before } is not allowed in JSON”. Remove the last comma and it validates.
Common mistakes to avoid
- Using single quotes. JSON strings and keys need double quotes.
- Leaving trailing commas or comments. Both are valid in JavaScript but not in JSON.
- Storing long IDs as numbers. Numbers above 253 lose precision; store them as strings. To build structured data, try the JSON-LD schema generator.
Sources and methodology
The calculations on this page follow these published standards and references. The code is covered by automated tests against known values.