JSON minifier
Processed in your browser · nothing is uploaded
Removes every space and line break outside strings. On a formatted document that is typically a 15 to 30 percent reduction before any compression.
How to use the json minifier
Whether that saving is worth anything depends on whether the response is gzipped, and it usually is. Gzip compresses repeated whitespace extremely well, so minified and formatted JSON often land within a few percent of each other over the wire. Where minifying genuinely helps is anywhere compression is not applied: data in a database column, embedded in a page as a string, put in a cookie or a header, or written to a file that is read back directly. For an ordinary HTTP API, turning compression on is worth far more.
The size of the win depends entirely on the shape of the document. The four-line sample above is 30 bytes formatted and 19 minified, because it is almost all indentation. A flat document of long string values barely moves, since strings are never touched. Deep nesting with short values is where minifying earns its keep.
It is worth being clear about what minifying is not. It does not shorten keys, deduplicate repeated strings or pack anything more tightly: a payload that repeats "customerReference" ten thousand times still repeats it. Those wins come from the code that produces the JSON, or from a binary format such as MessagePack, and no amount of whitespace removal substitutes for them.
One consequence of how this works: the document is parsed and written out again rather than scanned for spaces, so numbers are normalised on the way through. 1.0 comes back as 1 and 1e3 as 1000, which is the same value. An integer beyond 9007199254740991 does not survive intact, which is not a quirk of this tool but of every JavaScript consumer your JSON will meet, and the reason large IDs belong in strings.
Questions
15 to 30 percent typically. Over a gzipped connection the real-world saving is much smaller.
Enable gzip or brotli first, that matters far more. Minify on top if the payload is large.
No. Only whitespace outside strings is removed, so the parsed result is identical.
It normalises how they are written, because the document is parsed and re-emitted: 1.0 becomes 1, 1e3 becomes 1000. An integer above 2^53 loses its last digits, as it would in any JavaScript consumer.
No. Only whitespace goes. Shorter key names are a decision for whatever produces the JSON.
Yes, always. It is part of the value.
No. Parsing and formatting happen in your browser, which matters when the JSON is an API response with real data in it.