Minify JSON to one line and see the bytes saved
Take out the spaces and line breaks to make JSON as small as it gets. Every value stays the same, and the status bar shows the size before and after.
How to use it
Paste formatted JSON, or open a file. The result appears as you paste; the status bar shows the size before, the size after and how much smaller it is. Copy the result, or download it as minified.json. Switch to Format to make it readable again.
Examples
Minify a config
{
"name": "web",
"replicas": 3,
"ports": [80, 443]
}{"name":"web","replicas":3,"ports":[80,443]}Spaces inside strings stay
{
"greeting": "hello world",
"tags": [ "a", "b" ]
}{"greeting":"hello world","tags":["a","b"]}Only whitespace between values goes; the two spaces inside the string are data.
What minifying removes
The minifier reads the JSON first, so text that isn’t valid JSON is not minified; you get the line and column of the error instead. Numbers are copied as written, so 1.50 stays 1.50 and 64-bit IDs keep every digit. A byte order mark at the start of a file is dropped.
Minifying in code
JSON.stringify(JSON.parse('{"id": 12345678901234567890, "price": 1.50}'))
// → {"id":12345678901234567000,"price":1.5}When to minify JSON
Questions
- Is my JSON uploaded?
No. Everything runs in your browser, so your JSON stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. - Does minifying change my data?
No. Only whitespace outside strings is removed. Values, key order and duplicate keys stay as they were. - How much smaller will my JSON get?
It depends on the indent and the number of lines. The sample on this page goes from 128 to 95 bytes, 26% smaller; the status bar shows the numbers for your JSON. - Can it remove comments from my JSON?
Yes, with Repair on. Comments are not part of JSON, so without it the minifier stops at the first one and names its line; Repair removes them and lists each one. - Can I make minified JSON readable again?
Yes. Switch to Format, or paste it into the JSON formatter , which adds the line breaks and indent back.