How to minify JSON
- Paste your JSON into Input.
- The minified JSON appears right away, and the status line shows how many characters were removed. Turn on Sort keys to order keys alphabetically as well.
- Copy the single line or download it as minified.json.
What stays the same
Only the whitespace between values is removed (and the key order changes if you tick Sort keys). Every value is copied exactly as you wrote it, which many minifiers don’t do because they read the numbers into JavaScript first:
| Input | Output |
|---|---|
1.0 |
1.0 |
1e3 |
1e3 |
"caf\u00e9" |
"caf\u00e9" |
12345678901234567890 |
12345678901234567890 |
{"a": 1, "a": 2} |
{"a":1,"a":2} |
Duplicate keys are kept too. Most parsers keep only the last one when they read the file, so it’s worth removing them at the source.
How much smaller it gets
It depends on how the JSON was indented. Pretty-printed JSON with deep nesting carries a lot of indentation, so it shrinks more than a flat list of short values. If the JSON is sent over HTTP with gzip or Brotli, the saving after compression is smaller than the character count suggests, because whitespace compresses well.