What minifying JSON saves, and when it is worth it
JSON is often written for people: two or four spaces of indent, a line per key, a space after each colon. Machines do not need any of that. Minifying removes it, so the same data takes fewer bytes on the wire and in storage. A typical pretty-printed API response shrinks by 20 to 40 percent, and deeply nested data with long indents shrinks more. The note under the result tells you exactly how much your file saved, in the UTF-8 bytes a server would actually send.
The saving matters most where nothing else compresses the data. JSON stored in a database text column, sent in a URL or a cookie, kept in localStorage, or embedded in an HTML page as a script block is stored exactly as written, so every space costs a byte. For HTTP responses the picture is different. Servers usually compress JSON with gzip or Brotli, and those are very good at squeezing repeated spaces. Minifying first still trims a few percent, but the big win has already happened.
A minifier must not change the data, and the usual shortcut does. JSON.parse followed by JSON.stringify removes the whitespace, but it also rounds any number longer than about 16 digits and moves keys that look like numbers to the front of each object. A 64-bit ID such as 1234567890123456789 comes out as a different ID. This tool reads the JSON with its own parser, which keeps numbers as the digits you wrote and keys in the order you wrote them, so the minified output is the same data with less space.
Spaces inside strings are data, so they stay. "New York" keeps its space, and a string that contains a line break keeps it as the escape \n. The one change inside strings is cosmetic: escapes such as \u00e9 are written as the character é and \/ as /. Every JSON reader treats the two forms as the same text, and the plain form is usually shorter.
If the JSON is not valid, nothing is written. The first problem is shown with its line, column and a plain cause, such as a trailing comma after the last item, a comment, or a string in single quotes. That makes the minifier a fast validity check as well: paste, and if a one-line result appears, the JSON is valid. Everything happens in this page, so you can minify private data without sending it anywhere.