Skip to content

Developer tools

JSON Formatter, Validator and Minifier

Format, validate and minify JSON in your browser. Broken JSON gets the line, column and the offending line, not a character offset you must count to.

empty

About the json formatter

Formatting JSON is a one-liner in any console. Finding out why a 400-line file will not parse is not, and that is what this page is actually for. When JSON is invalid you get the line, the column and the offending line itself — not "Unexpected token } at position 1847", which tells you nothing you can act on without counting characters.

That turns out to be harder than it sounds, because browsers do not agree on how to report the failure. V8 emits three different message shapes depending on what went wrong: one with a position and a line and column, one with only a snippet of your source and no position at all, and one that just says the input ended early. Each is handled separately here, so a missing comma and a truncated file both land on the right line.

Everything runs in your browser. This matters more for JSON than for most formats, because the JSON people need to debug is usually an API response, and an API response usually contains a token, a customer record or an internal identifier. Pasting that into a server you do not control is a data disclosure, however routine it feels. Nothing here is uploaded, so there is nothing to disclose.

The key-sorting option is for diffs. Two config files that differ only in the order their keys were written produce an enormous diff for no reason; sorting both first reduces it to the lines that genuinely changed. Array order is never touched, because in JSON the order of an array is part of the data.

Minifying is the same parse in reverse, and the byte count next to the output tells you whether it was worth doing. For a config file it usually is not. For a payload you are about to send on every request, it usually is.

Frequently asked questions

Was this tool helpful?