JSON Minify Online
Compress valid JSON into a compact single line for APIs, environment variables, logs, and embedded payloads.
What does JSON minify do?
Minification parses a JSON value and serializes it without optional indentation or line breaks. Spaces within a quoted string are part of the value; spaces between tokens are lost. The output is a single-line compact document, which is easier to fit into systems that expect one line.
If strict parsing fails, this tool attempts the same common-syntax repair used by JSON Fix before it minifies. Check the repaired meaning before treating the result as equivalent to the source.
When to minify JSON
- Environment variables and secrets managers — a single line is often easier to paste and transport.
- Compact fixtures or documentation examples — less vertical space when humans do not need to review the nested structure.
- URL parameters — shorter text before percent-encoding, provided the receiving application expects JSON there.
- Request bodies — fewer raw bytes before transport compression.
Minification is not a security feature and it is not the same as gzip or Brotli compression. It reveals nothing, and repeated whitespace already compresses well, so compressed HTTP responses may gain only modest additional benefit.
Review numeric and embedding boundaries
The browser parses numbers as JavaScript numbers. Integers outside the safe integer range can lose precision when they are parsed and serialized. If an identifier is larger than Number.MAX_SAFE_INTEGER, represent it as a quoted string or use a pipeline with explicit arbitrary-precision handling.
If you are going to embed the result in a shell command, an HTML attribute, a URL or a source-code string, minification is just the first step. Use the escaping rules for that destination. A compact JSON document is still not automatically safe in all surrounding syntaxes.
For debugging or code review, keep the formatted version. One line is convenient for machines and rather unfriendly to the person on call at 2 a.m.