About JSON Formatter
JSON Formatter & Validator pretty-prints, minifies, sorts keys, and validates JSON instantly. Errors are reported with a precise message so you can fix malformed input fast. Everything happens inside your browser — paste sensitive payloads without sending them to a server.
- No uploads
- Browser-only
- Works offline
- 100% free
How it works
- 1
Paste your JSON
Type or paste any JSON value (object, array, string, number).
- 2
Pick an action
Format with 2/4-space or tab indent, minify into a single line, or sort keys recursively.
- 3
Copy or download
Use the result in your code, copy to clipboard, or save it as a .json file.
Format, validate, minify — and when you'd want each
Pretty-printing (formatting) adds indentation and line breaks so a human can read or diff the structure — the move when an API hands you a single 4,000-character line. Minifying strips every optional space and newline for the opposite reason: the smallest payload to ship over the wire or embed in a config. Validation is the quiet one that matters most — it parses the text with the browser's native JSON.parse, per RFC 8259, and points at the exact position of the first syntax error, which is usually a trailing comma, a missing quote, or a stray newline inside a string.
The errors that trip people up
- Trailing commas — legal in a JavaScript object, illegal in JSON. {"a":1,} fails; this is the single most common paste error.
- Single quotes — JSON requires double quotes on both keys and string values, so 'key' is invalid.
- Comments — JSON has none. // and /* */ belong to JSON5/JSONC; strip them before parsing.
- Unquoted keys — {key:1} is a JS object literal, not JSON; it must be {"key":1}.
- Unescaped control characters — a literal newline or tab inside a string has to be written \n or \t.
Why 'sort keys' is more than tidiness
Sorting keys recursively produces canonical JSON: the same data always serialises to the same bytes no matter what order a program emitted the keys. That's what makes two config files diff cleanly in Git instead of showing phantom reorderings, and it's a prerequisite for any signature or hash over a JSON document — sign the canonical form or the signature breaks the moment a key order changes. If you're hashing canonical JSON, the SHA-256 hasher takes the sorted output directly.
Pasting real payloads safely
API responses and webhook bodies routinely carry tokens, session ids, email addresses and internal URLs. Because this formatter runs entirely in your tab — no request leaves the page — pasting a production payload to debug it is safe in a way that server-backed 'JSON beautifier' sites are not. Still, scrub anything you then copy into a bug report or screenshot. Spotted a JWT in the payload and want to read its claims, or need to turn a CSV export into JSON? Reach for CSV ↔ JSON.
Related guides
All guidesConcepts
Why local-first tools are faster, safer, and more dependable
The case for processing your files in the tab you already have open — not on someone else's server.
7 min read
Developer
A daily developer toolkit that never opens a tab to elsewhere.com
JSON, Base64, regex, hash, diff, JWT — the everyday utilities developers reach for, all in one place, all local.
6 min read
Concepts
What is OCR and how accurate is it really?
Optical Character Recognition turns pixels into text. Modern OCR is astonishing on clean scans and quietly terrible on phone photos of receipts. Here's why, and how to get the best out of it.
10 min read
Developer
Cron expressions — the visual guide for engineers
The five-field format, the gotchas that bite everyone, and the cron flavours you'll meet in GitHub Actions, Kubernetes, and AWS.
10 min read
Frequently asked questions about JSON Formatter
What kinds of JSON can I validate?
Any RFC 8259-compliant JSON. The parser is the browser's native `JSON.parse`, so trailing commas and JS-style comments will be flagged as errors (use a JSON5 tool for those).
Why use this instead of a desktop tool?
It's faster — no install, no Electron — and runs offline. The same in-browser engine validates and formats megabyte-scale payloads in a few hundred milliseconds.
What does ‘sort keys’ do?
It produces canonical JSON: every object's keys are alphabetised, recursively. Useful for diffing or signing.
Privacy, offline use, browser support, and pricing questions are answered on the site-wide FAQ.