# JSON Minifier

> Compress JSON to a single compact line to save bytes in API responses and config files.

Canonical: https://host-tools.com/tools/json-minifier/

---

## What is a JSON minifier?

A JSON minifier removes insignificant whitespace from a JSON document, producing a single compact
line that is smaller to send over the network and faster to parse.

## Why this one?

It validates the document first (invalid JSON is never silently corrupted), reports how many
characters you saved, and never uploads your data anywhere.

## What minifying can change

Minification parses your JSON and writes it back out. That is what makes it safe from a *syntax*
point of view, but it also normalises some values. Real examples:

| Input | Output | Why |
| --- | --- | --- |
| `1.0` | `1` | Numbers are written back in their shortest form |
| `-0` | `0` | Negative zero is not preserved |
| `12345678901234567890` | `12345678901234567000` | JavaScript numbers lose precision past 15–16 digits |
| `{"a":1,"a":2}` | `{"a":2}` | Duplicate keys collapse; the last one wins |
| `{"10":1,"2":1,"1":1}` | `{"1":1,"2":1,"10":1}` | Integer-like keys are reordered |

The whitespace *inside* strings is untouched, and escapes such as `\n`, `\t` and `\u00e9` are
preserved. If any of the changes above would hurt you, store the value as a string (an id, for
example) and check the output before shipping it.
