TBToolbox
Developer Tools

JSON Minifier

JSON Minifier parses the complete input with JSON.parse and serializes it with JSON.stringify without indentation. Invalid syntax fails; comments, trailing commas, undefined, NaN, and JavaScript object-literal syntax are not accepted. Parsing can change extremely large integer precision and serialization does not preserve original whitespace, escape spelling, or a source-level property-order guarantee.

Runs locally — files stay on your device
Quick answer

Does minifying compress data?

It removes optional JSON whitespace but applies no general-purpose compression.

Minification operates on parsed data

Whitespace outside JSON strings is insignificant. Parsing first prevents accidental removal of spaces inside string values.

How it works

JSON.parse creates a value and JSON.stringify returns its compact textual representation.

Key concepts

Strings retain spaces

Only structural whitespace is removed.

Parse then serialize

Lexical details can be normalized.

When to use it

  • Reduce readable formatting in a request sample.
  • Normalize JSON before a byte comparison.
  • Confirm syntax while producing compact output.

When not to use it

  • Do not preserve forensic source formatting.
  • Do not process integers beyond safe JavaScript precision without review.
  • Do not expect schema validation.

Worked examples

Object

Input
{ "a": 1 }
Expected output
{"a":1}

Structural spaces disappear.

String space

Input
{"a":"x y"}
Expected output
{"a":"x y"}

String content stays.

Trailing comma

Input
{"a":1,}
Expected output
Error

It is invalid JSON.

Common mistakes

Calling it gzip

No entropy compression occurs. Correction: Use transport compression separately.

Expecting comments retained

JSON has no comments. Correction: Use a comment-capable format.

Ignoring number precision

JSON.parse uses Number. Correction: Protect large identifiers as strings.

Best practices

  • Keep an original when lexical form matters.
  • Validate application schema separately.
  • Measure actual transport compression at deployment.

Related operations and differences

XML Minifier

Choose XML Minifier when you need to remove whitespace between XML tags.; use JSON Minifier specifically for json minify.

CSV to JSON

Choose CSV to JSON when you need to convert a header-based CSV table to JSON.; use JSON Minifier specifically for json minify.

Extract JSON Values

Choose Extract JSON Values when you need to list every primitive value in a JSON document.; use JSON Minifier specifically for json minify.

JSON Beautifier

Choose JSON Beautifier when you need to format JSON with readable indentation.; use JSON Minifier specifically for json minify.

JSON Flattener

Choose JSON Flattener when you need to flatten nested objects into dot paths.; use JSON Minifier specifically for json minify.

JSON Key Sorter

Choose JSON Key Sorter when you need to sort object keys recursively.; use JSON Minifier specifically for json minify.

Limitations and privacy

  • No schema, JSON5, comments, streaming, file input, gzip, lossless large-integer mode, or lexical preservation.

Input is processed locally in this browser and is not uploaded by the tool.

Frequently asked questions

Are spaces inside strings removed?

No.

Does it validate JSON?

Syntax is validated during parsing.

Are comments supported?

No.

Can large integers change?

Values beyond JavaScript safe integer precision can.

References