JSON minifier
Remove unnecessary whitespace from JSON.
Your result will appear here.
Enter your input, then run the tool.How to use the json minifier
Make valid JSON more compact by removing whitespace outside its values. The result can be copied or downloaded.
Paste JSON, run the tool and check the compact output.
- Paste formatted JSON into Input. The example is a small indented object.
- Press Run tool.
- Check the one-line result. Invalid JSON shows the browser’s parse error instead.
- Use Copy result, or download hth-json-minifier.txt.
Good to know
- Invalid JSON is rejected; comments and trailing commas are not accepted.
- The tool parses and reprints values, so very large unquoted numbers can lose precision.
- Key order follows JavaScript object parsing rules; this is not a byte-preserving whitespace remover.
- Input is limited to 500,000 characters and processed in your browser.
Examples
- { "hello": "world" } spread over three lines → {"hello":"world"}.
- {"a":[1.0, 1e3, -0]} → {"a":[1,1000,0]}. Numbers are rewritten in their shortest form.
- {"id": 12345678901234567890} → {"id":12345678901234567000}.
If something goes wrong
An ID number changed after minifying.
Integers above 9,007,199,254,740,991 lose precision. Store large IDs as strings, such as "12345678901234567890", before minifying.
A repeated key disappeared.
Duplicate keys collapse to the last value: {"a":1,"a":2} becomes {"a":2}. Rename one key if you need both.
The key order changed.
Keys that look like whole numbers move to the front in ascending order: {"b":1,"10":2} becomes {"10":2,"b":1}. Use non-numeric keys if order matters.
Questions
Will it remove spaces inside strings?
No. Spaces inside quoted JSON strings are part of the value.
Can it minify JSON with comments?
No. Standard JSON parsing rejects comments.
Why did a large number change?
JavaScript numbers cannot represent every integer above 2⁵³−1 exactly.
Next steps: JSON formatter · JSON validator
