Using the JSON Minifier
This page removes insignificant space from one JSON value. It parses the text first, then writes the value again in compact form. The sample {"a": 1} becomes {"a":1}. A broken value, such as a lone opening brace, is rejected. The page does not delete spaces by search-and-replace, because a space inside a string is significant and a missing comma is not something a trim should hide.
The headline is the character count of the compact value. The compact value itself is the text under the headline, and that text is what copy returns. The lines show the original character count, after trimming the ends, and the minified character count. The sample compact value has 7 characters.
You can paste up to 20,000 characters. A longer paste is rejected. The page does not fetch a URL, and it does not run the JSON as a program. Keys stay in the order they were parsed. Slashes and non-ASCII characters are written without extra escape sequences.
What Minified Means Here
Minified, on this page, means the JSON written by a parser with insignificant space removed. Spaces between tokens go away. Newlines between tokens go away. A space inside a string stays, because it is part of the string. {"a": 1} has a space after the colon. The compact form {"a":1} does not. {"a": "b c"} keeps the space between b and c.
The headline count for the sample is 7: the characters {, ", a, ", :, 1, and }. The original line counts the trimmed input, which is longer because of the space. If you paste a pretty-printed object with newlines and indentation, the original count includes those characters and the minified count does not.
Copy returns the compact text, not the headline count. If you need both, copy and also write down the count. Reset clears the field back to the sample {"a": 1}. The previous compact text stays on screen until you minify again.
How the Text Is Parsed
The text is trimmed at the ends, then parsed as one JSON value. An object, an array, a string, a number, true, false, and null are all JSON values. A pretty-printed object with newlines is one value. Two values side by side, with no array around them, are not one value, and the page rejects them.
After a successful parse, the value is written with slashes and Unicode left unescaped. A string that contains a slash stays a slash. A string that contains a character outside ASCII is written as that character, not as a \\u escape. Numbers are written in ordinary JSON number form. A trailing comma, which some programming languages allow, is not valid JSON here and is rejected.
Joining wrapped lines of prose is a different cleanup. The Remove Line Breaks tool removes line breaks from text. It does not parse JSON, so it can glue a key to the next line without knowing whether a comma was missing. Use it for prose. Use this page when the text is supposed to be JSON.
What the Parser Will Not Fix
The page will not add a missing comma, a missing quote, or a missing brace. Those repairs would be guesses. The message for a bad value is "Enter valid JSON." It does not point at a line number. If you need a line number, use a formatter that reports one, then come back here to compact a value that already parses.
Comments are not JSON. A block comment or a trailing comment causes a rejection. Remove the comments first. Single quotes around a key are also rejected. JSON strings use double quotes. The page will not convert single quotes for you, because a single quote can appear inside a real string and a blind replace would corrupt it.
The 20,000 character cap counts the text you pasted, before minifying. A value under the cap that expands is unlikely, because minifying removes space, but the cap is on the input. Split a huge document yourself. The page will not stream a file from disk.
Worked Values
Paste {"a": 1} and minify. The text under the headline is {"a":1} and the headline is 7 characters. Paste the same object with newlines and indentation. The compact text is still {"a":1}. Paste [1, 2, 3]. The compact text is [1,2,3]. Paste "ok". The compact text is "ok", including the quotes, because a JSON string includes its quotes.
Paste { and the page rejects it. Paste nothing but spaces and the page asks you to paste a JSON value. Paste {"a":1}{"b":2} and the page rejects it, because that is two values. Wrap them in an array if you meant one value: [{"a":1},{"b":2}].
Counting sentences will not tell you whether the braces match. The Sentence Counter counts sentences in prose. A JSON object is not a sentence. Use that counter for prose. Use a successful minify here as the sign that the value parsed.
Limits of a Compact Rewrite
Key order is the order the parser produced, which for an object is the order the keys appeared. The page does not sort keys alphabetically. If you need a sorted object for a comparison, this is not that tool. Two objects that differ only by key order will stay different if their keys were written in different orders.
Numbers that were 1.0 may be written as 1. That is ordinary JSON number writing, not a change the page describes as rounding a measurement. Very large integers can lose precision if they do not fit the parser's number range. If you are compacting identifiers that are longer than a safe integer, keep them as strings in the JSON. The page will not switch them to strings for you.
The page does not pretty-print. There is no indent control. The output is the compact form only. If you wanted readable indentation, you want the opposite of this page.
Common Mistakes
The usual miss is to paste a JavaScript object literal. {a: 1} is not JSON, because the key is unquoted. {"a": 1} is JSON. The page will reject the first and compact the second. Adding the quotes is your edit, not an automatic fix.
Another miss is to expect the headline to be the JSON. The headline is a count, so a screen reader and a quick glance can see the size. The JSON is the block under it. Copy uses that block. If you copy the headline by hand from the count, you have copied a number of characters, not the value.
A paragraph count is not a JSON check. The Paragraph Counter counts paragraphs. Minified JSON is often one line and would look like one paragraph even when it is invalid. Use this page's parser for validity. Use the paragraph counter for prose.
When a Compact Value Helps
A compact value is easier to paste into a single-line field, a query, or a fixture that forbids pretty-print space. It is also a stable way to see the character count after space is gone. It is not a security review. The page does not look for secrets, tokens, or personal data. If the JSON contains a secret, compacting it does not hide the secret. Do not paste secrets you would not want in a result you might copy.
Use the original and minified counts to see how much of the paste was spacing. A pretty-printed object can shrink a lot. A value that was already compact shrinks little or not at all. Equal counts mean the parser rewrote the value without needing to drop space, or that the rewrite happened to land on the same length. Compare the text, not only the counts, before you assume nothing changed.
Keep a copy of the original if you still need the indentation. This page does not keep a history. Reset brings back the sample, not your previous paste.
Reading a Compact Result
Start with the sample and read every character of {"a":1}. Curly braces wrap one object. Quotes wrap the key. The colon separates the key from the value. The value is the digit 1, with no quotes, so it is a number. There is no space. That seven-character string is the whole result text. The headline "7 characters" matches a count of those characters. If you add a space in the result by hand, you no longer have the page's output.
Then try a string value. {"a": "b c"} compacts to {"a":"b c"}. The space between b and c remains. The spaces that were around the colon do not. This is the distinction the page exists to protect. A homemade "delete every space" edit would have turned the value into "bc" and corrupted the data. If your compact result lost a space that lived inside quotes, something other than this page produced it.
Arrays compact the same way. [1, 2] becomes [1,2]. Nested values compact inside the same rules. {"a": [1, 2]} becomes {"a":[1,2]}. The page does not flatten the array into the object. If a nested value is invalid, the whole paste is rejected. You do not get a compact version of the valid half.
Identifiers in a surrounding system are unrelated to this rewrite. The UUID Generator draws an identifier. It does not parse braces. Use it when you need an identifier. Use the character-by-character reading above when you are checking a compact JSON value.
Checking the Sample
Count the characters in {"a":1} yourself. Seven characters, matching the headline. Change the sample to {"a": "b"} and confirm the compact text is {"a":"b"} and that the space after the colon is gone. Put a space inside the string and confirm it survives.
Language links for a page are a different kind of markup. The Hreflang Generator builds link elements for language versions. It does not parse JSON. Use it for those links. Use the seven-character sample to audit this page.
Three Values Worth Pasting
Paste the number 0 as the entire field. The compact text is 0 and the headline is 1 character. Paste true. The compact text is true, four characters, with no quotes. Paste false and null the same way. They are JSON values, not objects, and they are valid. A page that demanded curly braces would be a different tool. This one accepts any single JSON value.
Checking the Calculator
Minify {"a": 1}. Confirm the text is {"a":1} and the headline is 7 characters. Minify [1, 2]. Confirm [1,2]. Submit a lone opening brace and confirm the rejection. Submit spaces only and confirm the page asks for a JSON value.