JSON Formatter and Minifier
Pretty-print unreadable JSON, or squeeze it back down to one line.
Runs entirely in your browser
Loading the tool…
Two directions, one box. Formatting expands a payload so every key sits on its own line at a consistent indent, which is what you want when reading an API response. Minifying goes the other way and strips every space and newline that is not inside a string, which is what you want before putting JSON in a config value, a query parameter or a database column, where the whitespace is pure cost, typically 15 to 30 per cent of the payload before compression.
Key order is preserved exactly as you pasted it. That matters more than it sounds: a formatter that sorts keys produces a file that no longer matches the one your service emits, and every diff after that is noise. Duplicate keys are kept as they arrived too, rather than being silently collapsed, so you can see that the document has them.
Everything happens in this tab as WebAssembly, so a large response is limited by your machine rather than by an upload. If what you have is broken rather than merely ugly, JSON Validator points at the line and column that stopped it parsing.
How to use it
- Paste JSON into the input box.
- Choose an indent width and press Format, or press Minify to compact it.
- Copy the result, or fix the reported error if the JSON is invalid.
Questions
Does formatting change my data?
No. The JSON is parsed and re-printed, so only whitespace changes. Key order, numbers and string contents come back exactly as they went in.
Why did my large numbers change?
JSON numbers beyond about 15 significant digits cannot be represented exactly as doubles. If you are handling IDs that long, transport them as strings.
What indent should I use?
Two spaces is the common default for JavaScript ecosystems and the most compact readable option; four is easier to scan on deeply nested documents.
Does it sort or rename anything?
No. Key order, duplicate keys, string contents and escapes all come out as they went in. The only thing that changes is the whitespace between the tokens, which is what formatting means and is why the result is still the same document.
Can it format a very large file?
Up to whatever your browser will hold, which on a laptop is comfortably tens of megabytes. Nothing is uploaded, so there is no request size limit to run into; if it struggles, the constraint is memory in the tab rather than a server rejecting the file.
What is the difference between minified and compressed?
Minifying removes whitespace and is reversible by formatting again. Compression such as gzip encodes the bytes and needs decompressing before anything can read it. Servers usually do both: minified JSON, sent gzipped.
Why does it refuse a file that my editor opens?
Because the editor is being generous and this is not. Comments, trailing commas, single quotes and unquoted keys all appear in config files and none of them are JSON. Those are JSON5 or JSONC, which are different formats that happen to look similar.
Your data stays on your device
Everything above runs inside your browser as WebAssembly compiled from Rust. Nothing you type is uploaded, logged or stored on a server. You can load this page once, go offline, and it still works.
This page makes no requests at all, to anywhere. That is not a promise in the copy: it is a Content-Security-Policy header your browser enforces, and connect-src on it is none. Open the network tab and watch nothing happen.