Developer Tools

JSON Minifier

When a JSON fixture needs to fit on one line, removing formatting by hand is error-prone. This minifier parses the document first so spaces within text values remain intact. Use the result in a compact request body, test fixture or environment configuration that expects valid JSON. Minification reduces formatting overhead; it does not change your transport settings or replace gzip and Brotli. If the source contains duplicate keys, only the last parsed value for each key survives.

Your workspace

Runs locally in your browser

Result

Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.

How to use this tool

Paste a JSON document and select Minify. Copy the result into your file or request body.

Example

Input

{ "status": "ok", "count": 3 }

Output

{"status":"ok","count":3}

What does this tool do?

Minified JSON removes indentation and line breaks outside strings. This is useful for fixtures and compact configuration, but it is not compression.

Common mistakes and limitations

Whitespace inside string values is retained. Parsing may normalize numeric notation and duplicate object keys; keep the original when byte-for-byte fidelity matters.

What disappears and what stays

Indentation, line endings and spaces around structural punctuation are removed. Spaces within a string remain because they are part of the value. For example, the two spaces in "New York" must not become one. This minifier parses and reserializes JSON, so it can also normalize exponent notation and escapes. It is appropriate for a compact data representation, not preservation of an original signed byte sequence.

{
  "city": "New  York",
  "count": 2
}
→ {"city":"New  York","count":2}

Measure the right kind of size reduction

The benefit depends on how much formatting the input contains. A deeply indented document may shrink noticeably; an already compact response may barely change. A shorter character count is not always the same as a smaller UTF-8 byte count because some characters occupy several bytes. HTTP compression such as gzip or Brotli works on transmitted bytes and can reduce repeated data even after minification. Enable that at the delivery layer rather than expecting this text transformation to configure it.

Keep a readable source of truth

Minified fixtures are convenient for one-line environment values or quick request examples, but reviewing a large one-line diff is difficult. Keep readable JSON in source control when human review matters and minify as a build step. Invalid input is rejected rather than partially compacted. Do not delete comments or commas blindly to make a file pass: first decide whether the file is JSON, JSON-with-comments or a JavaScript object.

Avoid minifying the wrong format

A file with a .json extension may still contain comments accepted by a particular editor or configuration system. This tool intentionally accepts standard JSON only. When building a request body, confirm the server expects JSON rather than a JSON string containing another JSON document. The outer quotes of a double-encoded payload are meaningful data; whitespace removal will not correct that integration mistake.

Frequently asked questions

Does minification encrypt my data?

No. Minified JSON remains readable data and provides no confidentiality.

Related tools