JSON minifier
Production APIs and log shippers often send compact JSON without pretty whitespace. Minifying removes indentation and line breaks while preserving data — shrinking bytes for bandwidth and storage. Validate first, minify second, all in-browser.
Input
Output
{"a":1}
How to minify JSON
1. Paste pretty-printed JSON.
2. Click minify — invalid JSON shows parse error.
3. Copy single-line result.
4. Use in HTTP body, env vars, or embedded config.
Minify examples
Embed in HTML data attribute
Shrink chart config JSON to fit inline script tag with fewer bytes.
Lambda env size
AWS env vars have size limits — minify nested JSON secrets wrapper.
Mobile API request
Reduce POST body size on slow networks — every KB counts on 3G.
When to minify JSON
• When shipping JSON over wire repeatedly at scale.
• When storing many similar config blobs.
• When tools require single-line JSON (some CLIs).
When to keep pretty JSON
• In git repos where humans diff changes — pretty format helps reviews.
• When gzip makes whitespace irrelevant and readability matters locally.
• When minifying would break signed canonical JSON — some auth schemes require exact bytes.
Canonical JSON for signing
JWT and some blockchain APIs require canonical byte order. Blind minify after sorting keys may be required — check spec before minifying signed payloads.
Debugging minified logs
Keep pretty copies in dev; minify only prod pipeline output. Paste minified log lines into formatter when investigating incidents.
Size math
Pretty JSON with 4-space indent can be 30–50% larger than minified for deep objects — measure on representative payloads.
Frequently asked questions
Does minify change data?
No — only insignificant whitespace is removed; values and key order stay the same (key order preserved as parsed).
Minify vs compress?
Minify removes spaces; gzip compresses further at HTTP layer — both stack.
Invalid JSON?
Minifier fails parse — fix with validator first.
Unicode escaped?
Standard stringify may escape non-ASCII — behavior matches JSON.stringify.
Local?
Yes.
Reverse pretty print?
Use JSON formatter after minify for readable view.