JSON Formatter & Validator
Paste JSON. Get pretty, valid JSON back. The status line tells you if it's valid, how many keys it has, and how the byte size changed.
What this tool does
- Format (pretty-print) — indent with 2 spaces, 4 spaces, or tabs.
- Minify — strip all whitespace. Switch to "minify (no whitespace)" in the Indent dropdown, or use the dedicated minify page.
- Validate — confirms the JSON parses cleanly and shows the parser's error position if not.
- Sort keys — recursive alphabetical key sort, useful for diffing.
Why client-side
The other "JSON formatter" sites all upload your JSON to their server
to format it. That's a privacy and bandwidth tradeoff for no reason —
parsing and re-serializing JSON is a JavaScript built-in,
JSON.parse(JSON.stringify(...)). Your browser already has
everything needed.
tooljo's formatter does exactly that, in ~3 KB of JS.
Nothing leaves your machine. Open DevTools → Network and verify.
The status line
Below the editor you'll see something like:
✓ Valid JSON · 27 keys · 412 bytes (-58 bytes (12% smaller)) "Keys" counts every key in every nested object, recursively — useful for spot-checking that an export didn't lose data.
Common JSON errors
- Trailing comma —
[1, 2, 3,]is JS-valid but JSON-invalid. - Unquoted keys —
{name: "Alice"}needs{"name": "Alice"}. - Single quotes — JSON strings always use double quotes.
- Unescaped backslash —
"path": "C:\users"needs to be"path": "C:\\users"in the JSON literal (the file showsC:\users). - NaN / Infinity — JSON has no IEEE-754 special values. Most languages fail to parse them.
- Comments — JSON has no comment syntax. JSONC, JSON5, and Hjson are non-standard supersets.
Tips
- Ctrl/Cmd-A then paste replaces the whole input. Useful for switching between examples.
- Sort + format together produces a stable canonical form, ideal for storing in git or comparing across runs.
- Minify + copy is the fastest way to get JSON into a single-line context (URL parameter, log line).
API coming soon
For server-side use cases (CI fixtures, bulk validation, schema generation), we're building an HTTP API. Drop your email below to be notified.
FAQ
Is my JSON sent to a server?
No. Everything runs in your browser. Open DevTools → Network and paste anything you want — no requests are made while you format.
How big a JSON can it handle?
Hundreds of MB in modern browsers. The bottleneck is the textarea rendering, not parsing. For files larger than ~50 MB, paste in chunks or use a streaming parser in your application code instead.
What if my JSON is invalid?
The status line shows the parser's error message — usually 'Unexpected token X at position N', which points at the byte offset. Common causes: trailing commas, unquoted keys, single quotes (use double), unescaped backslashes in strings.
Can I sort the keys?
Yes. Tick the 'Sort keys' checkbox. Sorting is recursive — every nested object gets keys sorted alphabetically. Useful for diffing two JSONs that differ only in key order.
Does it handle JSONC (JSON with comments)?
No — strict JSON only. Comments aren't valid JSON, so they're rejected. For JSONC (used in tsconfig.json, VS Code settings), strip the comments first or use a JSONC-aware tool.