JSON Formatter
Format, validate, and minify JSON with syntax highlighting. Runs on your device — nothing is uploaded, nothing is stored.
The JSON Formatter pretty-prints, validates and minifies JSON. Paste a raw or mangled payload and it re-indents the structure at two or four spaces, so nested objects and arrays become readable again.
If the JSON won't parse, the exact parser message is shown along with the line it gave up on — usually enough to spot the trailing comma or unclosed bracket in a few seconds. There's also a sort-keys switch that recursively alphabetises every object, which turns two differently-ordered API responses into a clean diff, and a minify button that strips all whitespace back out.
It uses the browser's own JSON parser, so what it accepts is exactly what your code will accept — no more forgiving, no less. Everything happens in the tab; the payload is never sent anywhere.
Why this runs on your device
The JSON people need to format is usually a live API response, which means it routinely contains a bearer token, a session cookie, a Stripe object, an internal user record, or a customer's address and phone number. Pasting that into a formatter that posts to a server is a small data-leak you perform on yourself, and a surprising number of popular online formatters do exactly that. Here JSON.parse runs in your tab and the string never leaves it — which also means the tool keeps working on a locked-down corporate network, or on a plane.
- Paste your JSON into the input area.
- Set the indent to 2 or 4 spaces, and turn on sort keys if you need a canonical order.
- Choose Format to pretty-print, Minify to compact it, or Validate to just check it.
- Fix any reported parse error, then copy or download the result.
- It accepts strict JSON only, because it is the browser's own parser. Comments, trailing commas, single-quoted strings, unquoted keys and other JSON5 or JSONC conveniences are all rejected — handy if you're validating what a strict server will accept, frustrating if you're editing a tsconfig.
- Numbers pass through JavaScript's number type. Integer IDs beyond 9,007,199,254,740,991 — Discord and Twitter snowflakes, some database keys — and high-precision decimals will come back subtly changed after formatting. If your payload has large IDs, don't round-trip it through here.
- Duplicate keys in the same object are silently collapsed to the last one, and keys that look like integers get reordered ahead of the rest by JavaScript's own property ordering. Both are standard parser behaviour, and both mean the formatted output is not always a byte-faithful reordering of your input.
- It's a formatter, not an editor: no collapsible tree view, no JSONPath or query support, no schema validation, and no diff. The input is a plain text area, so multi-megabyte documents will make typing sluggish.