Hunt
Skip to content

JSON Minifier

Paste JSON to remove every space, tab and line break between its values and get it on one line, ready for a request body, an environment variable or a config field. It validates as it goes, showing errors with their line and column, and never changes a value: large numbers, trailing zeros and escapes stay exactly as written.

Runs in your browser

Why values stay exact

The usual shortcut, JSON.stringify(JSON.parse(text)), converts every number to a JavaScript number and back. That rounds integers beyond 2^53 (12345678901234567890 becomes 12345678901234567000), drops trailing zeros (19.90 becomes 19.9) and rewrites escapes. This minifier works from the text instead, removing only the whitespace between tokens, so the output means exactly what the input did. Whitespace inside strings is kept.

How to use the JSON Minifier

  1. Paste JSON, or press Sample.
  2. Fix any error shown with its line and column.
  3. Copy or download the minified JSON, and check the bytes saved.

Examples

Numbers and escapes stay exact

Input
{
"id": 12345678901234567890,
"price": 19.90,
"name": "Caf\u00e9 \"Central\"",
"tags": [ "coffee", "wifi" ],
"open": true,
"manager": null
}
Output
{"id":12345678901234567890,"price":19.90,"name":"Caf\u00e9 \"Central\"","tags":["coffee","wifi"],"open":true,"manager":null}

152 bytes to 124. JSON.stringify would have printed the id as 12345678901234567000 and the price as 19.9.

Spaces inside strings are kept

Input
{ "message": "Hello,   world",  "lines": [ "a b", " c " ] }
Output
{"message":"Hello,   world","lines":["a b"," c "]}

How much it saves

Indentation is often a third of a formatted JSON file. Over HTTP the difference mostly disappears once responses are compressed with gzip or Brotli, so minify when size matters uncompressed: storage, environment variables, URLs, logs, or embedding JSON in another file.

Common errors and how to fix them

Trailing comma

A comma after the last item is accepted by JavaScript but not by JSON. Remove it before minifying.

Invalid
{ "items": [1, 2, 3,] }
Fixed
{ "items": [1, 2, 3] }

The tool reports: Trailing commas are not allowed in JSON.

Limitations

  • Input up to 10 MB.
  • Strict JSON only: comments and trailing commas are reported as errors, not removed.
  • Duplicate keys are kept as they are.

Frequently asked questions

Does minifying change my data?

No. Only whitespace between values is removed; every string, number and escape is copied exactly.

Can I minify JSON with comments?

Not here: comments aren't valid JSON, so they're reported as errors. Remove them first, or use the JSON Fixer, which converts JSON5 and similar input to valid JSON.

How do I make minified JSON readable again?

Paste it into the JSON Formatter, which indents it again without changing any value.

Is my JSON uploaded?

No. Minifying runs in your browser; your JSON is never sent anywhere or logged.