JSON minifier

Try JSON Minifier

JSON Minifier inputs

Loading calculator. If this message stays visible, enable JavaScript and reload.

Worked example

Paste { “a”: 1, “b”: true } — 21 UTF-8 bytes — and click “Calculate / Run”. The output is {“a”:1,“b”:true}, 16 bytes: the spaces and line breaks around the punctuation are gone, while the keys, values, and order are unchanged. A string keeps its own spaces: { “text”: “A B” } (18 bytes) becomes {“text”:“A B”} (15 bytes), with the space between A and B intact, and the array [ 3, 1, 2 ] (11 bytes) becomes [3,1,2] (7 bytes) in the same 3, 1, 2 order.

How to use the JSON Minifier

Paste actual JSON into “JSON input” — no Markdown fences, comments, or trailing commas — and click “Calculate / Run”. Keep an unchanged copy of the source, compare important values and array order against the compact output, and only then paste the result into its destination; a successful run is not a guarantee of faithful number preservation for very large integers.

Related tools

The JSON minifier turns valid pasted JSON into a compact representation without indentation or optional formatting spaces. Paste into JSON input, choose Calculate / Run and inspect the result. For example, { "a": 1, "b": true } becomes {"a":1,"b":true}. Spaces that belong inside string values remain part of those values.

MoneyOr parses the input into JavaScript values and serialises those values again. That matters when exact representation is important: large numbers can round, duplicate object names can collapse and numeric notation can change. Keep the original. This tool is useful for ordinary JSON samples, but it is not a lossless byte-level compressor or a canonicalisation tool for signed data.

Producing compact JSON with clear limits

How does the JSON minifier process the input?

The JSON minifier processes your text in two stages. First, the browser parses the supplied JSON text. If parsing succeeds, it serialises the resulting value without requesting indentation. This removes the formatting normally added to make objects and arrays easier to read. It also means the output represents the parsed values, rather than preserving every character of the original document.

Whitespace inside a string is different from formatting around JSON punctuation. In { "text": "A B" }, the two spaces between A and B remain. The compact result is {"text":"A B"}. Removing those spaces would change the string's data, so a generic space-removal tool is unsuitable for this task.

Escapes are part of JSON's representation too. A string containing an escaped line break still represents that line break after processing; it does not become an instruction to lay out the surrounding object. Distinguish an escape within a quoted value from a formatting newline outside it. Both can look like a break when displayed by a particular editor, but they serve different purposes in the data.

Use the result when a compact textual representation is what you need. Do not assume that a one-line output proves numerical precision, schema compliance or compatibility with your receiving application. Those require separate checks. The tool accepts a JSON value, not an application specification describing which properties or ranges that value should contain.

How do I minify and check JSON step by step?

  1. Save an unchanged copy of the source.
  2. Paste actual JSON into JSON input, without surrounding Markdown fences.
  3. Choose Calculate / Run.
  4. If an error appears, correct the input syntax and run again.
  5. Compare important values and array order with the source.
  6. Copy only the compact JSON into the intended destination.

For an unfamiliar payload, start by making it readable with the JSON formatter. Review nested values and field types before choosing compact output. A minified line hides indentation cues, so it is harder to inspect manually even though it can still represent nested data.

Keep JSON and its surrounding transport separate. An HTTP status line, a copied console label or a code fence is not part of a JSON value. If a server returned HTML instead of JSON, removing formatting will not convert that page into JSON. Check the response and its intended format before trying to repair the pasted text.

Also check whether your input is an object or a JSON string that contains a second JSON document. Extra surrounding quotes and escaped quotation marks can indicate the latter. This tool parses the supplied top-level value once; it does not automatically unpack layers until it finds an object. Use the representation required by the receiving interface, rather than deleting backslashes until the text looks familiar.

When the compact output is destined for a configuration file or API request, test it in that actual workflow before replacing a working source. Use a safe test environment where appropriate. The minifier does not submit requests, edit server files or save configuration changes on your behalf.

What do the worked examples demonstrate?

These examples were checked against MoneyOr's engine. The byte counts use UTF-8 for the exact ASCII examples shown. They describe the JSON text alone, without a file marker, surrounding report, HTTP headers or transport compression.

InputCompact outputUTF-8 bytes before / after
{ "a": 1, "b": true }{"a":1,"b":true}21 / 16
{ "text": "A B" }{"text":"A B"}18 / 15
[ 3, 1, 2 ][3,1,2]11 / 7
nullnull4 / 4

The array retains its sequence: 3, then 1, then 2. Minification is not sorting, deduplication or filtering. Likewise, the value null is already compact and does not become smaller. The amount of removable formatting depends on the actual input; there is no guaranteed percentage reduction.

For a real payload, measure the encoding and delivery method you will use. A character count is not always a byte count, particularly with non-ASCII text. The file size converter can compare size units once you have measured bytes, while the character counter answers a different question about text characters.

Which inputs are rejected, and how should I interpret an error?

The tool requires JSON syntax. Checked invalid examples include a trailing comma, single-quoted property names, a JavaScript-style comment and the standalone word undefined. An empty input also fails. These are not corrected automatically. The tool reports an Invalid JSON message followed by the browser parser's explanation.

Read any reported position in the context of the actual pasted value. A missing quote or bracket earlier in the text can cause the parser to complain later. Browser versions can phrase the message differently. Focus on correcting the source's structure instead of depending on an error sentence staying identical across devices.

Use the JSON validator when you want a syntax check without compacting the output. Passing a syntax check does not establish that the content meets your application's schema. A syntactically valid object can still omit a required property or supply a string where the receiver expects a number.

Do not delete punctuation at random until an error disappears. That can produce valid but unintended data. Compare with the source specification, preserve an unchanged copy and correct the smallest identified problem. If a payload belongs to a different format, use a tool designed for that format rather than forcing it into JSON.

Can numbers, duplicate keys and property order change?

Yes. Parsing and serialising can change more than visible formatting. In a checked example, {"id":9007199254740993} becomes {"id":9007199254740992}. The original integer is not exactly represented by the browser's ordinary number type. Do not use this workflow for a precision-sensitive payload without reviewing its numeric requirements.

Duplicate object names also lose information. The tested input {"x":1,"x":2} produces {"x":2}. Both occurrences do not survive as independently inspectable properties. If duplicate names are possible, detect and resolve them in the original text before assuming a parse-and-serialise operation preserves the intended record.

Representation changes can occur even with small numbers. The checked input {"n":1.00,"z":-0} becomes {"n":1,"z":0}. Integer-like property names can also be emitted in a different order. These are reasons to keep the original when textual conventions or a particular ordering are part of a downstream requirement.

Extremely large exponents deserve special attention. In the tested input {"huge":1e400}, parsing produces a value outside the ordinary finite numeric range, and serialising produces {"huge":null}. A successful run is therefore not a guarantee of faithful numerical preservation. Use a suitable precision-preserving workflow when such values may occur.

Is minification the same as compression, encryption or canonical JSON?

Minification removes optional textual formatting. Transport compression uses a separate encoding mechanism and can reduce repeated content as well as formatting. This form does not create a gzip archive or configure a web server. Whether compacting a particular payload changes transfer time depends on its size and the real delivery environment.

Minification does not hide secrets. A compact password field or access token remains readable to anyone who receives the text. Removing indentation does not make a payload safe to publish or prevent another program from parsing it. Remove sensitive material through an appropriate review process before sharing a sample.

Canonicalisation requires a defined representation rule suitable for a particular purpose. This form does not claim compliance with a canonical JSON scheme. Do not minify signed content and expect a signature over the original bytes to remain valid. Even a change that preserves ordinary values can change the exact bytes used for a signature or digest.

The SHA-256 generator can illustrate that changing a text representation changes the input to a digest operation. A digest is not an automatic proof that two JSON documents have equivalent values. Decide whether your workflow compares bytes or parsed data before choosing a comparison method.

How should compact JSON fit into a development workflow?

Keep a readable source for maintenance and generate compact output only where it serves a clear requirement. The two representations have different conveniences: indentation helps people inspect nesting, while a compact line can fit a particular storage or transfer context. There is no need to discard the readable source just because compact output is available.

Review representative fields after processing. Check an identifier that could be numerically large, a string containing spaces, a nested array and any null or boolean values. These checks address different failure modes. Comparing only the first few characters can miss a changed field deeper in the payload.

If JSON must become part of a URL, minification alone is not URL encoding. The URL encoder addresses a separate representation task. Follow the receiving interface's rules instead of pasting raw JSON into a URL and assuming braces, quotes and separators will be interpreted as intended.

For automated builds or repeated production processing, use a reviewed local toolchain with tests appropriate to the data types involved. This pasted-text form is useful for inspection and small tasks. It does not replace schema tests, version control or a documented release process for configuration changes.

Retain a fresh source for each comparison. Comparing today's compact output with an older readable payload can make a legitimate data update look like a minification change. Generate both representations from the same source version, then inspect the fields that matter to the actual application. Keep the version identifier alongside both copies for future reference.

How do copying, downloads and privacy work?

The form requires no tool account or fee. Copy result copies the displayed output and any result details. Check that the destination receives only the JSON you intend. A code editor may visually wrap a compact line; that screen wrapping does not necessarily add stored line breaks.

Download CSV creates a result report, not a dedicated original-format JSON-file export. Save a baseline to compare two compact JSON results during the same page session. Reset returns the form to its starting values and clears its output. Keep the formatted source in your project so you can inspect it again.

The parse-and-serialise operation runs in your browser. Website delivery, analytics and contact practices are separate and covered by the MoneyOr privacy policy. Use synthetic values for confidential test payloads. A browser-side transformation does not make a general-purpose page an appropriate place for private keys or live credentials.

JSON minifier FAQs

Does the top-level value have to be an object?

No. The checked implementation accepts JSON values such as an array or null, as well as an object. Your receiving application may impose a narrower requirement. Confirm its contract rather than assuming that a value accepted by the parser is acceptable to every API or configuration system.

Can it remove comments from a configuration file?

It does not provide a comment-stripping mode. A comment in the pasted input causes the JSON parser to reject it. If your configuration format deliberately supports comments, use its own parser and tooling rather than removing material blindly and assuming the resulting document means the same thing.

Will running it twice keep making the output smaller?

Ordinary compact output has no added indentation to remove on the next run. Repeating the operation is not a strategy for continued size reduction. If the result is still too large for a limit, inspect the actual data and the receiving system's requirements instead of repeatedly submitting the same value.

Is a smaller result always faster to parse?

No specific speed improvement is guaranteed by this tool. Parsing cost depends on the payload and implementation, while delivery also depends on network and compression settings. Measure the actual workload if performance matters. The tool reports compact text, not a benchmark of your application.

Can I load JSON from a URL or upload a file?

This form has a pasted JSON input and no file-upload or URL-loading control. Obtain the intended JSON through an authorised workflow and paste only a suitable sample. The result does not automatically update the original file or remote resource.

Does it validate a JSON Schema or an API response contract?

No. It checks whether the text can be parsed, then serialises the value. It does not load a schema, check mandatory fields or enforce application-specific ranges. Use a validator configured with the correct schema and test the actual response contract separately.

Sources and method

Technical sources reviewed on 14 November 2026: IETF, RFC 8259: The JavaScript Object Notation Data Interchange Format, for JSON syntax and interoperability; and MDN Web Docs, JSON.stringify(), for serialising JavaScript values. The worked examples and representation warnings above were checked against MoneyOr's implementation. Preserve the source whenever exact numbers or original bytes matter.