JSON Formatter / Validator
Format, validate, and minify JSON. Sort keys, escape unicode, clear parse errors. Client-side.
How to use
Paste JSON into the left pane, or drop a file onto the drop zone. The output updates live as you type — formatted with your chosen indent in Format mode, collapsed to one line in Minify mode.
If the input isn't valid JSON, the output pane shows the parse error with the line and column where it occurred, so this doubles as a validator — there's no separate "validate" button to press.
Copy the result with the Copy button, or download it as formatted.json / minified.json. The stats footer tracks size, top-level key count, and nesting depth as you go.
Keyboard shortcuts
Three shortcuts:
| Cmd / Ctrl + K | Focus the input pane |
| Cmd / Ctrl + Enter | Copy the output to clipboard |
| Cmd / Ctrl + / | Switch between Format and Minify |
When to use it
Format when you need to read; minify when you need to ship.
- Making a minified API response readable before debugging against it.
- Checking whether a hand-edited config file is still valid JSON.
- Normalizing indentation before committing a JSON file to version control.
- Sorting keys to diff two JSON documents that differ only in key order.
- Minifying a payload before embedding it in a query string, env var, or fixture.
If you mainly want to explore a deep structure rather than re-print it, the JSON Tree Viewer is the better fit.
Options
Indent — 2 spaces (default), 4 spaces, or a tab character per nesting level. Only shown in Format mode; Minify always produces a single line with no whitespace between tokens.
Sort keys A→Z — recursively sorts every object's keys alphabetically, at every nesting level, in both modes. Values and array order are untouched. Useful for stable diffs.
Escape non-ASCII — replaces every character above U+007E in the output with its \uXXXX escape. The result is pure ASCII and still parses to the exact same strings.
Format-specific gotchas
Big numbers lose precision. JavaScript parses JSON numbers as IEEE 754 doubles, so integers beyond 253−1 (like 64-bit IDs) get rounded, and long decimals may re-print differently. If exact digits matter, keep them as strings.
Duplicate keys collapse. JSON with the same key twice in one object is parsed by keeping only the last occurrence — the earlier value silently disappears from the output.
Trailing commas are invalid. {"a": 1,} is legal in JavaScript but not in JSON — the tool rejects it with an error. Same for single quotes and unquoted keys; convert loose JS-object syntax with the JSON ↔ JS Converter first.
Comments are not JSON. // and /* */ comments belong to JSONC/JSON5, not RFC 8259 JSON, and will fail validation here.
Privacy
Everything runs in your browser. Your JSON never leaves the page — no server, no logging, no analytics on the content.