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 are happy with JSON squeezed onto one line, but people are not: a minified API response with nested objects is almost impossible to read. A JSON formatter (also called a beautifier or pretty-printer) adds line breaks and indentation so the structure becomes clear at a glance. A JSON validator checks that the text follows the JSON rules exactly, so you find mistakes before your code or an API does.
Features
- Beautify with 2 spaces, 4 spaces or tabs.
- Minify to the smallest valid form for transport or storage.
- Sort keys alphabetically at every level, which makes two JSON documents much easier to compare.
- Validate with precise error locations (line and column) and a highlighted output that colors keys, strings, numbers, booleans and null.
- Download the result as a .json file.
The most common JSON errors
- Trailing commas:
[1, 2, 3,]is valid JavaScript but invalid JSON. - Single quotes: JSON strings and keys must use double quotes:
"name", not'name'. - Unquoted keys:
{name: "x"}must be{"name": "x"}. - Comments: standard JSON does not allow
//or/* */comments. - Special values:
undefined,NaNandInfinityare not allowed in JSON. - Unescaped characters: line breaks and tabs inside strings must be written as
\nand\t.
Large numbers and precision
This formatter uses your browser’s built-in JSON parser, which follows the official standard. Like all JavaScript tools, it stores numbers as 64-bit floating point values, so integers larger than 9,007,199,254,740,991 (for example, some database IDs) may lose precision when re-formatted. If your data contains huge IDs, the tool warns you so you can keep them as strings.
Safe for sensitive data
API responses often contain tokens, emails and customer records. Because everything runs locally, nothing you paste here leaves your device.