Processed in your browser

JSON Minifier

Validate and compact JSON locally into a single-line representation for transport, logs, or storage. Unsafe integers are rejected to prevent silent precision loss, and duplicate keys produce a warning before the standard parser keeps the final value.

Processed in your browser
0 / 1,000,000
Minified JSON

Tool guide

What is JSON Minifier?

JSON Minifier removes formatting whitespace from API examples, logs, and configuration while preserving the underlying data. It validates and serializes the document instead of blindly deleting spaces, so whitespace inside strings remains intact and invalid syntax, unsafe integers, or duplicate keys cannot pass unnoticed. Common workflows include the following. Shorten JSON that must be pasted into a request parameter or ticket. Confirm that formatted and compact documents represent the same structure. Generate stable single-line JSON after validation. The page also documents input boundaries, output behavior, and practical cautions so you can review the result before putting it into an application, configuration, test, or production workflow.

When to use it

  • Shorten JSON that must be pasted into a request parameter or ticket.
  • Confirm that formatted and compact documents represent the same structure.
  • Generate stable single-line JSON after validation.

How to use it

  1. Paste valid JSON with any amount of whitespace.
  2. Minify it and review validation or duplicate-key warnings.
  3. Copy the compact result.
  4. Load one of the realistic examples first to verify the selected options and processing direction before replacing it with your own data.
  5. Review the output, status message, and documented limits; copy, download, or continue only after the result matches your expectation.

Runnable examples

The “Example 1” and “Example 2” buttons load the matching inputs. They cover different structures, directions, or boundaries and can be run directly in the workspace.

Example 1

{
  "service": "api",
  "retry": {"count": 3, "delays": [200, 500, 1000]},
  "enabled": true
}

Example 2

{
  "users": [
    {"name": "Ada", "roles": ["admin", "editor"]},
    {"name": "Lin", "roles": ["viewer"]}
  ]
}

Input rules

  • Input must be valid JSON; whitespace inside strings is preserved.
  • Comments, trailing commas, and unquoted keys are rejected.
  • Unsafe integers are rejected and duplicate keys are reported.
  • Text input is counted before processing and is limited to 1,000,000 characters on this page; file modes apply the separate file limit shown in the workspace.
  • Comments and trailing commas are invalid JSON and are rejected.

Output rules

  • Output is a single JSON line without formatting whitespace.
  • Object keys keep their parsed input order and are not sorted.
  • Array order, strings, booleans, numbers, and null retain their meaning.
  • Output reflects only the current input, direction, and options; rerun after changing a mode or value instead of treating an earlier result as current.
  • Integers outside JavaScript's safe range are rejected.

Limitations and cautions

  • Comments and trailing commas are invalid JSON and are rejected.
  • Integers outside JavaScript's safe range are rejected.
  • Duplicate keys trigger a warning; if processed, the final value is kept.

How your data is handled

Validation and minification run entirely in the browser. The page does not retain the input, output, or errors.

FAQ

Does minifying change JSON values?

No. It removes insignificant whitespace and serializes the same parsed arrays, objects, strings, booleans, numbers, and null values.

Why are very large integers rejected?

JavaScript can silently change integers outside its safe range. The tool refuses them instead of returning corrupted output.

Is my JSON uploaded?

No. Validation and minification run only in this browser tab.

Does minification remove spaces inside strings?

No. It removes formatting whitespace around the JSON structure while preserving whitespace and escapes inside string values.

Why can minified JSON still be large?

This tool removes insignificant whitespace only; it does not delete fields or apply gzip or another compression algorithm.

Can it minify configuration files with comments?

No. Standard JSON does not allow comments or trailing commas, so the input must first be converted to valid JSON.

Updated: 2026-07-31