A minified API response is one line 40,000 characters long, and finding the field you want in it is genuinely impossible. The JSON Formatter parses the payload and prints it back with indentation, or strips every byte of whitespace when you need to go the other way for a config value or a header.
Because it parses rather than pattern-matches, the tool is also a validator. Malformed JSON produces no output at all, just a red panel naming the fault, and the input box grows a red border so you know which side the problem is on. That is a more useful answer than a best-effort reindent of something broken.
Formatting reruns on every keystroke and on every change of indent or mode, so there is no button to press. Indent is 2 or 4 spaces, the selector hides itself in minify mode where it would mean nothing, and a character count sits above the input. Your payload stays in the page.
Running a Payload Through Beautify
- Paste into Raw JSON Input. The placeholder shows the shape it wants, a bare object across 3 lines.
- Leave Beautify selected and pick an indent of 2 or 4. Two is the JavaScript convention and four is more common in Python and Java codebases.
- Read the output. It is a fresh serialisation of the parsed value, not your text reformatted, so key order is preserved but original spacing, trailing commas and comments are all gone.
- Switch to Minify when you need the payload on one line, for a curl command or an environment variable. The indent buttons disappear because minified output has no indent.
- Press Copy for the result, or Clear, which empties both panes and returns focus to the input so you can paste again straight away.
What Happens When the JSON Is Broken
- The panel prints the browser's own parser message and then a location line, either
(Located around line 3, column 10) when the engine reported one, or a character offset when it only gave a position. - Different browsers word the message differently. Firefox tends to give line and column directly while Chrome reports a position index, which is why the location line has 2 shapes.
- Trailing commas are the most frequent cause. JSON forbids them even though JavaScript object literals allow them, so a config copied out of a source file often fails on its last property.
- Single quotes are not valid JSON either.
{'a': 1} is a JavaScript object and a syntax error here, and the fix is double quotes on both the key and the value. - Very large numbers lose precision silently, because parsing goes through a double. An ID beyond 9,007,199,254,740,991 will come back rounded, so keep such identifiers as strings in the payload.
- The input is never modified on your behalf. A failed parse leaves your text exactly as you pasted it, so a stray keystroke cannot destroy the original while you hunt for the fault.