JSON Formatter

Format, validate, and minify JSON data with syntax highlighting.

0 characters
Result will appear here

About JSON formatting

JSON — JavaScript Object Notation — is the de facto data format of the web. Almost every API you'll touch returns JSON, almost every config file in the modern stack uses JSON or one of its close cousins (JSON5, JSONC, NDJSON), and almost every log aggregator stores events as JSON. The format itself is simple, but the moment you have to read a 200-line API response that came back as one long string, or a config file that someone hand-edited and broke, you need a formatter.

This tool does three things: it pretty-prints valid JSON with proper indentation, it minifies it back down to a single line for transport, and it validates it — telling you exactly where a syntax error sits. Everything runs in your browser. The JSON you paste never leaves your machine, which matters when you're debugging API responses that contain customer data or auth tokens.

Pretty-printing vs. minifying

Pretty-printing inserts newlines and indentation so structure is readable. Use it for debugging, for committing JSON to source control where diffs matter, and for documentation. Minifying strips all whitespace down to the minimum legal output. Use it for HTTP request bodies, for embedding JSON in attributes or query strings, and anywhere bytes-on-the-wire matter. The two operations are perfectly reversible — the parsed structure is the same either way.

Common reasons JSON breaks

How errors are reported

When parsing fails, the tool surfaces the underlying error from the browser's parser, which usually pinpoints the line and column where it gave up. The actual problem is sometimes a few characters earlier — a missing closing brace, for instance, isn't detected until the parser hits something unexpected later on. If the message says "Unexpected token ]" and the bracket itself looks fine, look upward for the missing comma or extra one.

Useful tricks