What minifying JSON removes
JSON allows any amount of whitespace between tokens: spaces after colons and commas, indentation, and line breaks between properties. None of it carries meaning, so a minifier can delete all of it. That is the only change made here. Whitespace inside strings is part of the data and stays, so "Leave at the door" keeps both spaces.
On a typical pretty-printed API response the saving is a quarter to a third of the size. The first example below goes from 230 bytes to 170, a 26% cut, and deeply nested documents indented with 4 spaces shrink more. Compression such as gzip or Brotli narrows the gap considerably because repeated spaces compress well, so the biggest wins are where compression is not applied: values stored in a database column, a Redis cache, environment variables, URL parameters, or log lines that are written one record per line.
Lossless by design
Many online minifiers run JSON.parse followed by JSON.stringify. That silently changes data. Integers beyond 2^53 get rounded, so an order ID of 9007199254740993 turns into 9007199254740992; 129.90 becomes 129.9; 1.50e+2 becomes 150; escapes such as \u0041 are expanded. This page uses a lossless streaming JSON parser and printer instead: every number is copied digit for digit, and strings keep their original escape sequences. The minified output therefore means exactly what the input meant to every parser, including ones in Java, Go or Python that do handle 64-bit integers.
A UTF-8 byte-order mark at the start of the input is removed with a note, because many parsers refuse it. Duplicate keys are a related trap. They are kept as written, in order, with a warning that most parsers keep only the last value, instead of one being dropped without notice.
Options that change the output
- Sort keys in the toolbar orders the keys of every object alphabetically before minifying. Two documents with the same content then minify to identical strings, which is what you want for cache keys, content hashes, signature payloads and clean diffs. Array order never changes.
- Escape non-ASCII writes every character outside ASCII as a
\uXXXXescape, so"Zoë"becomes"Zo\u00eb". The output grows a little, but it survives systems that mangle UTF-8, such as some legacy message queues and HTTP headers.
Inline short arrays and Indent only affect pretty-printing and have no effect while minify is on. Switch back and forth with Ctrl/Cmd+Shift+M, and copy the single-line result with Ctrl/Cmd+Shift+C.
Invalid JSON is never minified
The minifier is also a validator. If the input has a trailing comma, a comment, single quotes, NaN or a missing bracket, you get an error with the line and column instead of output, because quietly producing something from broken input only moves the problem downstream. For the common mistakes, the Fix it button repairs the input first. JSON with comments, such as a tsconfig.json, belongs in the JSON5 / JSONC formatter, which understands comments.
Because the parser streams with constant memory, multi-megabyte files minify comfortably. Everything runs in your browser tab, so a payload containing customer records is never uploaded.
Examples
Pretty-printed order with a 64-bit ID
The ID keeps its last digit and 129.90 keeps its trailing zero, which a JSON.parse round trip would both lose.
{
"orderId": 9007199254740993,
"total": 129.90,
"currency": "SGD",
"customer": {
"name": "Zoë Lim",
"city": "Singapore"
},
"items": [
{ "sku": "KB-104", "qty": 1 },
{ "sku": "MS-220", "qty": 2 }
]
}
{"orderId":9007199254740993,"total":129.90,"currency":"SGD","customer":{"name":"Zoë Lim","city":"Singapore"},"items":[{"sku":"KB-104","qty":1},{"sku":"MS-220","qty":2}]}Stable minified config with sorted keys
Keys are ordered alphabetically at every level, so the same settings always produce the same string and the same hash.
{"version": 2, "env": "prod", "features": {"search": true, "beta": false}, "app": "checkout"}{"app":"checkout","env":"prod","features":{"beta":false,"search":true},"version":2}ASCII-only output for a legacy consumer
Accented and CJK characters become \u escapes, which any JSON parser decodes back to the same text.
{"name": "Zoë Lim", "note": "配送 before 6pm"}{"name":"Zo\u00eb Lim","note":"\u914d\u9001 before 6pm"}Common errors and how to fix them
| Error | Cause | Fix |
|---|---|---|
Trailing comma before '}'Explained | The last property of an object is followed by a comma, which JavaScript allows but JSON does not. | Delete the comma, or press Fix it to remove every trailing comma at once. |
Comments are not allowed in JSONExplained | The input contains // or /* */ comments, usually because it is a JSONC config file. | Remove the comments, or minify it with the JSON5 / JSONC tool, which strips them as part of the format. |
Object keys must use double quotes, not single quotesExplained | The text is a JavaScript or Python object literal rather than JSON. | Replace the single quotes with double quotes, or let Fix it convert them. |
Unexpected end of input: 1 bracket is still open — '{' opened at line 1Explained | The document was cut off, so an object or array is never closed. | Copy the complete payload again; the message names the line where the unclosed bracket opened. |
Frequently asked questions
Does minifying JSON change the data?
No. Only whitespace between tokens is removed. Numbers, string escapes and key order stay exactly as written, unless you turn on Sort keys.
How much smaller does minified JSON get?
Usually 20 to 40 percent for pretty-printed input, depending on indentation depth. After gzip the difference is much smaller, because whitespace compresses well.
Can I minify JSON that contains comments?
Not as strict JSON, since comments are invalid there. Use the JSON5 / JSONC formatter in minify mode, which accepts comments and trailing commas.
How do I turn minified JSON back into readable JSON?
Switch the toolbar from Minify to Beautify, or use the JSON formatter. The round trip is lossless, so nothing is lost either way.