JSON Formatter

Validate, format, or minify JSON; syntax errors are reported with position and reason.

What this tool does

The JSON formatter does three things: re-indents a minified one-line JSON payload with 2-space indentation so it becomes readable; minifies indented JSON down to a single line to shrink payloads; and validates syntax only. When the input is invalid, the tool reports where and why parsing failed — a missing comma, an unclosed quote, a trailing comma — instead of leaving you to hunt through hundreds of lines by eye.

Parsing uses the browser's native JSON.parse, entirely on your device. Nothing is uploaded, so it is safe to paste responses that contain internal endpoints or test data.

Typical use cases

API responses are usually served minified; paste one here and the structure becomes obvious. Before saving package.json or a VS Code settings file, validate it first — a single stray comma can stop a whole service from booting. When digging through logs, formatting the embedded JSON and then searching is far faster than reading raw text.

The reverse direction is just as common: minify JSON before embedding it as mock data or pasting it into a field with a size limit.

Caveats

Strict JSON is stricter than a JavaScript object literal: keys must use double quotes, trailing commas and comments are illegal, and single quotes or undefined are not allowed. Most validation failures come from pasting a JS object and assuming it is JSON. If your text contains comments, it is really JSON5 — strip the comments first.

Also note that JSON has no date, regex, or binary types (they must be strings), and key order carries no semantic meaning even though this tool preserves it in the output.