JMin

JSON Minifier

Minify JSON, escape Unicode, and compare UTF-8 bytes

JSON & Data
🔒 100% client-side — your data never leaves this page
Maintained by Evan•Updated: September 29, 2026•Reviewed: September 29, 2026
Options

Paste JSON, choose options, and click Minify. Editing input or options clears the previous result. Advanced mode provides worked examples.

Output
Minified JSON appears here

Byte counts measure UTF-8 text, not gzip or Brotli network transfer. Escaping non-ASCII characters can increase size.

JSON stays in this page’s memory. Only display options are saved, not input or results; analytics excludes JSON content. Copying writes the result to your system clipboard.

This tool parses and reserializes JSON. Duplicate keys keep the last value, numbers beyond JavaScript’s safe integer range may round, and number spelling may change; non-finite values are rejected. Use strings in the source JSON for long numbers that must remain exact.

Sorting preserves array order and own keys; JavaScript integer-like keys still serialize in numeric order. This is not a standard JSON canonicalization scheme for signatures. The syntax example button loads a corrected example; it does not repair arbitrary input.

Page reading mode

The full guide also includes pitfalls, worked examples, snippets, FAQs, and related tools for checking results or troubleshooting.

About this tool

Paste strict JSON and click Minify JSON now. Optional recursive key sorting preserves own properties, including __proto__, and keeps array order. Unicode escaping turns non-ASCII code units into JSON escapes; it can increase the output size. Byte counts compare UTF-8 text before and after processing, not gzip or Brotli network transfer. This parser uses JavaScript numbers: non-finite results are rejected, but large finite integers can lose precision. Duplicate object names keep the last value and original number spellings may change. Use quoted strings for exact identifiers. Input is processed in this page and is not stored as a browser draft; only display settings may be saved.

Failure Input Library

Comment-like content mistaken for invalid JSON cleanup

Bad input: Manual pre-clean removes quoted strings containing `//` patterns.

Failure: Semantic data loss occurs before minification starts.

Fix: Never mutate content with regex pre-cleaning; rely on strict parser first.

Scenario Recipes

01

Check a Unicode size increase

Goal: Create ASCII JSON while keeping the decoded string value.

  1. Paste {"text":"你"}.
  2. Enable Escape Unicode and click Minify JSON now.
  3. Compare the 14-byte input and 17-byte output, then parse the output to confirm text is still 你.

Result: The output is {"text":"\u4f60"}: 3 more UTF-8 bytes, about 21.4% larger.

02

API fixture size reduction before embedding

Goal: Shrink payload fixtures while preserving semantic correctness.

  1. Run validation on original JSON before minification.
  2. Minify and compare parsed object hash against original structure.
  3. Store readable source beside minified artifact for debugging.

Result: Payload footprint drops without breaking test determinism.

Production Snippets

Special keys are retained when sorting

json

{"__proto__":{"keep":true},"a":[2,1]}

Quick Decision Matrix

Need compact JSON for transport or storage limits

Recommend: Validate then minify, and keep readable source for traceability.

Avoid: Avoid regex-based pseudo-minification on raw text.

Failure Clinic (Common Pitfalls)

A numeric value becomes non-finite

Cause: 1e400 is valid JSON number syntax but exceeds the JavaScript finite-number range.

Fix: The tool rejects it. For exact identifiers use strings, and use a suitable numeric parser for calculations.

Frequently Asked Questions

Does minification preserve every original character?

No. It parses and serializes JSON rather than only deleting whitespace. Strings retain their decoded values, but number spellings, duplicate object keys, and integer precision follow JavaScript parsing rules. Keep exact identifiers in strings.

Can Unicode escaping increase the size?

Yes. {"text":"你"} uses 14 UTF-8 bytes, while {"text":"\u4f60"} uses 17. The tool shows the 3-byte increase. Emoji use two surrogate escape sequences.

Is sorted JSON ready for cryptographic signing?

No. Recursive key sorting keeps own keys and array order, but does not implement a canonicalization standard such as RFC 8785. Use the signing protocol’s required serializer.

Are JSON drafts saved or uploaded?

This tool does not save input drafts or call a remote processing API. Old input drafts are removed when the page opens. Copying creates a clipboard copy under your control; website analytics preferences are separate.

What if my input has comments or a trailing comma?

The minifier rejects non-JSON syntax. JSON Formatter has a separate conservative Fix JSON action for some such cases; review its changes before using the result.

Keep browsing