Home › Developer Tools › JSON Formatter
JSON Formatter
JSON is the data format of the web — APIs, config files and saved data all speak it — but a single missing comma makes it unreadable. Paste JSON here to pretty-print it, minify it, or sort its keys, and if it is invalid you get the exact error with its line and column. Everything runs in your browser; nothing you paste is sent anywhere.
Valid JSON needs double quotes around every key and string value, commas between items but not after the last one, and no comments or trailing commas. This tool follows the strict JSON standard (RFC 8259), so JSON5-style extras like single quotes and unquoted keys are flagged as errors.
How it works
Formatting does not change the data — it only changes the whitespace. A JSON parser reads the input into a value (object, array, string, number, true/false/null) and the formatter writes it back out with one key per line, indented by the chosen amount; minifying writes it back with no whitespace at all, which is how JSON travels over the network. Sorting keys rewrites each object with its keys in alphabetical order, which makes two versions of the same data easy to diff. Nesting depth counts how many levels of objects and arrays wrap the deepest value. Worked example: {"name":"Ada Lovelace","born":1815,"fields":["math","computing"],"alive":false} formatted with 2-space indent becomes 9 lines with "name" on its own line and the two fields listed one per line; minified it is 79 characters, 4 keys, depth 2. Worked example 2 (error): {"a": 1,} is invalid — the trailing comma after 1 is not allowed in JSON — and the error points at line 1, column 9.
Frequently asked questions
What is JSON?
JSON (JavaScript Object Notation) is a plain-text format for structured data: objects with named keys, arrays, strings, numbers, and true/false/null. APIs return it, config files use it, and browsers parse it natively — which is why this tool can run entirely on your device.
Why format JSON instead of reading it as-is?
Minified JSON from an API is one long line. Pretty-printing puts each key on its own line with indentation, so you can see the structure, spot a missing field, and compare two responses side by side.
What does minify do, and why?
Minifying strips every space, tab and newline that is not inside a string, shrinking the text by roughly 20-40%. Servers send minified JSON because smaller payloads load faster; you format it back when you need to read it.
Why does JSON reject single quotes and trailing commas?
JSON is a strict standard (RFC 8259): strings and keys must use double quotes, and a comma must always be followed by another item. JavaScript objects are more forgiving, but a JSON parser is not — that strictness is what makes JSON safe to exchange between languages.
Is the JSON I paste sent to a server?
No. The formatting happens in your browser with the built-in JSON parser, and nothing leaves your device. That also means this tool works offline once the page is loaded.