JSON Minifier
Minify json content you provide.
About JSON Minifier
Pretty-printed JSON is pleasant to read but wastes bytes in an environment variable, a URL parameter, a database column or a fixture embedded in code. Developers use minification to squeeze a config or sample payload onto one line before pasting it somewhere that dislikes line breaks or has a size limit.
How it works
The input is parsed with JSON.parse and written back with JSON.stringify and no indent. All whitespace between tokens is removed. Spaces inside string values are kept, because they are data. The input must be strict JSON. Anything invalid stops with the parser's error, so this doubles as a validity check. Numbers are normalized on the way through. For example, 1.50 becomes 1.5 and 1e3 becomes 1000. The output can be saved as min.json and never leaves your browser.
How to use JSON Minifier
- Enter the text or data in the format shown in the text box above (Paste JSON).
- Select “Run tool” and check the result before copying or downloading it.
Worked example
Input, spread over five lines: {, "city": "New York", "zip": "10001", "price": 1.50, }, without the trailing comma. Output: {"city":"New York","zip":"10001","price":1.5} on a single line. The space inside New York stays, the indentation and line breaks disappear, and 1.50 is rewritten as 1.5.
Tips for a better result
- If exact numeric text matters, such as prices stored as 1.50, store those values as strings, because parsing rewrites number formatting.
- Minify a copy and keep the readable original in version control. Minified files produce noisy diffs that are hard to review.
- To put minified JSON inside a shell command, wrap it in single quotes so the double quotes inside the JSON survive.
Frequently asked questions
How much smaller will my file get?
It depends on how much indentation the original has. Deeply nested files with four-space indents shrink the most. Files that are already compact barely change, because only whitespace between tokens is removed.
Does it remove comments?
It cannot, because comments are not valid JSON and make the parser fail before any output appears. Delete the comments manually first. The minifier will then accept the file.
Can minifying change my data?
Strings and key order stay the same, but number formatting can change, and very large integers can lose precision. A key that appears twice keeps only its last value. Otherwise the data is equivalent.
What to check
A formatted or parsed result is not proof that code is secure, correct or production-ready. Never paste production secrets.
Read the Privacy Policy for information about local processing, connected services and advertising.