Developer guide
Minify JSON without changing the data
JSON minifying removes whitespace and line breaks after the input parses successfully.
The problem
Compact JSON is useful when pasting a payload into a script, an environment variable, a curl command, or a test fixture.
Example
{
"project": "1024base",
"ready": true,
"tools": ["json", "base64"]
}
{"project":"1024base","ready":true,"tools":["json","base64"]}
How to fix it
- Minification changes whitespace only. Object keys, values, arrays, booleans, numbers, and null stay the same.
- If the input has syntax errors, fix those first. A minifier needs valid JSON before it can safely rewrite the text.
- Keep a readable copy somewhere if the minified result will be hard to review later.
When compact JSON helps
Minified JSON is useful when a tool, environment variable, or command line expects one uninterrupted value. It also keeps small fixtures tidy when line breaks are not important.
Do not use minification as a privacy step. The data is still plain text, just with spaces and line breaks removed.
Common mistakes
- Trying to minify JSON with comments
- Minifying a JavaScript object literal instead of JSON
- Assuming minification encrypts or hides data
- Pasting a minified payload without checking it still parses
Related problems
FAQ
Does minifying JSON change the order of keys?
This tool parses and serializes the value. It keeps normal object property order as handled by the browser JSON implementation.
Is minified JSON faster?
It is smaller to transfer or paste, but the main benefit here is compact copy-ready text.
Can I format the minified JSON again?
Yes. Paste the minified text into the JSON Formatter and run Format JSON.