JSON Formatter
Processed Client SideBeautify and format raw JSON with syntax highlighting. Minify, sort keys, and copy output instantly.
Bookmark this tool now — skip the search next time you need it.
About JSON Formatter
This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.
Paste raw, minified, or badly indented JSON and get it back properly formatted and readable in one step. The formatter parses your input with the browser JSON engine, so anything it accepts is guaranteed to be valid JSON — and anything it rejects is reported with the exact line the parser gave up on, which is usually one line after the real mistake. Beyond pretty-printing it also minifies, switches indentation between two spaces, four spaces, and tabs, and can sort every object key alphabetically at every level of nesting so two versions of the same config become directly comparable. It is the fastest way to make an API response readable, tidy a package.json before committing it, or find the trailing comma that is breaking your build.
Key features
- Pretty-print any JSON with a choice of 2-space, 4-space, or tab indentation
- Minify in the same pane — strips every optional space and newline for the smallest possible payload
- Sort keys alphabetically through the entire tree, not just at the top level, so two configs line up for comparison
- Parse errors report the offending line number and highlight it, instead of a bare "unexpected token"
- Live "Valid JSON" badge so you know the input parsed before you copy anything out
- Syntax-highlighted input and output panes — keys, strings, numbers, booleans, and nulls each get their own colour
- Handles deeply nested objects, long arrays, and large API payloads without a size limit or a server round-trip
- One-click copy of the formatted result, and a Clear button to start over
- Runs entirely in your browser — the JSON you paste is never uploaded anywhere
How to use it
- Paste your JSON into the input pane, or start from the sample already loaded there.
- Click Format to pretty-print it, or Minify to collapse it onto one line.
- Pick your indentation — 2 spaces, 4 spaces, or tabs — from the selector in the toolbar.
- Turn on Sort keys if you want every object key ordered alphabetically at every depth.
- If the input is invalid, read the reported line number and fix the syntax, then format again.
- Click Copy output to put the result on your clipboard.
Tips & common mistakes
- When the parser reports an error on line N, check line N-1 first. A trailing comma or missing comma on the previous line is what usually makes the parser fail on the next one.
- Sort keys is the trick for diffing two JSON files that hold the same data in a different order — sort both, then paste them into the Diff Checker and only the real differences remain.
- JSON has no comment syntax. If your file has // or /* */ in it, it is JSON5 or JSONC, not JSON, and the parser will reject it — strip the comments first.
- Single quotes are not valid JSON string delimiters, and neither are unquoted keys. Both are common when copying an object literal out of JavaScript source.
- Minified output is what you want for a request body or an environment variable; formatted output is what you want for a file that a human will read in a code review.
- NaN and Infinity are not valid JSON values even though JavaScript accepts them — a serializer that emits them has produced something JSON.parse cannot read back.
- Need a dedicated minify-only tool with no formatting UI at all? Use the JSON Minifier.
- Embedding this JSON as a string value inside another document? Escape it first with JSON Escape / Unescape.
- Formatting a GraphQL query or schema instead of plain JSON? Use the GraphQL Formatter.