About the JSON Minify
JSON allows whitespace only between tokens, so minifying is lossless: the tool parses the document and re-serializes it with no spaces or line breaks. Whitespace inside strings is kept, because it is part of the data. The status line shows the UTF-8 size before and after and how many bytes were removed — typically 15–40% for pretty-printed files, depending on nesting depth and indentation width.
Minified JSON is useful for fixtures embedded in code, environment variables and CLI arguments that must fit on one line, localStorage values and message queues with size limits. For HTTP responses the gain is smaller than it looks: gzip or Brotli already compress repeated indentation very well, so enable compression on the server first and minify as a second step.
Because the input is parsed first, invalid JSON is reported with its line and column instead of being mangled. Sort keys A→Z produces a canonical key order, handy when you hash or compare payloads. The same limits as JavaScript apply: duplicate keys collapse to the last value and integers above 253 − 1 are rounded; both are flagged when they occur.
How to use it
- Paste formatted JSON or open a file.
- Optionally tick Sort keys A→Z.
- Check the size and savings in the status line.
- Copy the one-line result or download data.min.json.
Frequently asked questions
Does minifying JSON change the data?
Should I minify JSON API responses?
How do I minify JSON on the command line?
jq -c . input.json. With Python: python -m json.tool --compact input.json (Python 3.9+).