toolery

JSON formatter

Format, validate, and minify JSON, with clear error messages when something doesn’t parse.

—

How it works

Formatting isn’t text rearrangement — the input is parsed into a real in-memory structure first, checking that every brace, bracket, and comma is where it belongs, then written back out with consistent indentation. That parse step is why this doubles as a validator: nothing can be reformatted until it is fully understood, so a failure means a genuine syntax error and the message points at where it went wrong. Minifying runs the same parse and then serialises with no whitespace at all. JSON itself is indifferent to spacing, so both outputs carry exactly the same data — only the readability changes.

Read the full explanation
Used this in a paper or lesson?