How to Minify JSON
JSON minification removes insignificant whitespace outside string values — spaces, tabs, and newlines — from a JSON document, reducing its size without changing the data. It is the opposite of beautification and is used in production to reduce bandwidth, speed up API responses, and save storage space.
What is minified JSON?
Minified JSON is the same document written without optional whitespace outside its strings. Compact JSON and one-line JSON refer to this presentation. Spaces inside values stay intact. Minification produces text; gzip and Brotli are separate transport-compression steps.
For example, the UTF-8 document { "a": 1 } is 10 bytes; {"a":1} is 7 bytes, saving 3 bytes. Non-English characters may take more than one byte, so character counts are not file-size measurements.
Minify JSON in code
Every mainstream JSON library writes compact output by default or with one option. Parse first, then serialize, so invalid input fails loudly instead of being silently mangled.
// JavaScript / Node.js
const minified = JSON.stringify(JSON.parse(text));
# Python (separators drop the spaces after , and :)
import json
minified = json.dumps(json.loads(text), separators=(",", ":"), ensure_ascii=False)
# Command line with jq
jq -c . input.json > input.min.jsonNote that parsing and re-serializing can change very large integers in JavaScript, because they become floating-point numbers. The online JSON minifier keeps numeric tokens exactly as written.
Just need it done?
Paste or upload your file into the JSON minifier. It shows the exact UTF-8 bytes saved and lets you copy or download the result.
Minify JSON online{
"user": {
"id": 1,
"name": "Alice",
"email": "[email protected]",
"roles": ["admin", "editor"],
"active": true
}
}What Does JSON Minification Do?
A JSON minifier removes every character that is not part of the data itself:
- Spaces and tabs used for indentation
- Newline characters between keys and values
- Spaces around colons and commas
The resulting JSON is semantically identical — any JSON parser will read it exactly the same way. Only whitespace is removed; all keys, values, and structure are preserved.
How to Minify JSON Online — 3 Steps
When Should You Minify JSON?
When NOT to Minify JSON
Minification is for production and storage — not for development. During development, keep JSON formatted so you can:
- ✕Read and debug API responses without a tool
- ✕Review JSON config files in pull requests
- ✕Edit JSON files manually without introducing syntax errors
- ✕Log readable output during troubleshooting
JSON Minify vs JSON Beautify — Quick Comparison
- · Removes all whitespace
- · Smallest file size
- · Use in production
- · Not human-readable
- · Adds indentation & line breaks
- · Larger file size
- · Use in development
- · Human-readable
Minify Your JSON Now
Free, instant, and 100% private — processed entirely in your browser.
Open JSON Minifier