How to use JSON Minifier
Remove indentation and other structural whitespace from JSON. Get compact text for a request example, fixture or size comparison without modifying spaces inside string values or rewriting numbers.
- Paste valid JSON or open a file, then minify and copy or download the result.
- Check that the consumer expects an ordinary JSON document rather than one record per line.
- Select Minify and review the result.
Example input
{"title":"Field Notes","inStock":true,"quantity":12,"tags":["paper","stationery"]}Example use
Shrink a large configuration snippet for a request body while retaining spaces inside a display name and the exact digits of a numeric identifier.
Output and compatibility
The tool validates strict JSON then removes whitespace outside quoted strings. Object ordering, original escape sequences and numeric literals survive. It does not make a gzip archive, renumber records or remove data properties.
Use a saved text output to compare exact bytes
If an API must preserve long identifiers, store them as quoted strings in its data contract. Minification preserves the literal digits, while ordinary downstream parsing can still round these values. Keep a formatted version for reviews and minify as a delivery step. Compare saved UTF-8 byte counts if you need a reliable size comparison.
Troubleshooting
If the source contains trailing commas or comments, correct it before minifying. Leaving line breaks in a quoted string requires correct JSON escaping, even when the document itself is otherwise multiline.
If a receiving system expects a compressed file, apply the file compression it specifies after minifying the JSON.
Frequently asked questions
Will words inside a string get joined together?
Spaces and escapes inside strings are retained.
Will it round numbers above JavaScript’s safe integer range?
The numeric tokens are preserved as written in the output text.
Does it remove repeated keys?
The compact text keeps the original literal tokens. Different downstream parsers can interpret duplicated keys differently.
Can I minify several pasted objects at once?
Provide one JSON value, such as an array containing the objects, or use JSON to NDJSON for a line-delimited format.
Can I get the indentation back?
JSON Formatter adds fresh indentation. It cannot recreate arbitrary original spacing.