Minify JSON files in your browser
Parses the data, writes standard JSON with no formatting, and refuses invalid input instead of guessing what it meant.
or browse your device. Everything is processed on this device
No JSON to hand?
Got it on your clipboard?
How to minify JSON
Choose a .json file or paste an object or array. The data stays in this tab and is never uploaded.
Standard JSON is the default. Turn on Allow comments when the source genuinely contains // or /* */ comments.
The file is parsed before it is serialised, so a trailing comma, missing quote or other syntax error produces a clear refusal rather than damaged output.
Use the compact standard JSON directly. If the input was already no larger, the original file comes back unchanged.
What JSON minification actually does
Pretty-printed JSON spends bytes on indentation, line breaks and spaces after commas and colons. None of those characters changes the data. Parsing the document and serialising the resulting value produces the compact spelling while preserving spaces that live inside strings.
Comments are not part of JSON. Some configuration files use JSONC, which adds JavaScript-style line and block comments, so the optional setting strips those comments before running the normal JSON parser. It does not quietly accept trailing commas, single-quoted strings or unquoted keys.
For an API response, minification is useful but server compression matters more. Repeated keys make JSON particularly friendly to gzip and brotli. Send compact JSON and enable response compression; they solve different layers of the same problem and their savings stack.
JSON minification FAQ
Does minifying JSON change the data?
The document is parsed and serialised, so objects, arrays, strings, booleans and null retain their values. Formatting disappears. JSON number spellings may become their normal compact JavaScript representation, such as 1e2 becoming 100.
What happens when the JSON is invalid?
The tool stops with a json-invalid error and produces no rewritten file. It does not remove a trailing comma, add a missing quote or otherwise guess what the author intended.
Are comments allowed in JSON?
Not in standard JSON. Turn on Allow comments (JSONC) to accept // line comments and /* */ block comments outside strings. They are removed and the remaining document must still be valid JSON.
Will // inside a URL be treated as a comment?
No. The comment scanner tracks double-quoted strings and their escapes, so https:// URLs and text containing comment-like characters remain part of the string exactly as written.
Should an API minify JSON or use gzip?
Both. Compact JSON avoids sending formatting that no client needs, while gzip or brotli compresses repeated keys and values much more aggressively during transport. Server compression is the larger saving.
Related
Same format joins the queue. Anything else re-routes to its own tool.