{
"color": "red",
"count": 2
}Whitespace in JSON is for readers. On the wire it is cost. JSON minifier parses the document and writes it back with no space after colons or commas and no newlines. The result is one line. Compare its length with the source you pasted. A two-space pretty print of {"color":"red","count":2} is 34 bytes. The minified line is 25 bytes. Nine bytes were indentation and the spaces that sit beside colons.
If you paste a string that is already compact, the result matches the paste and the saving is zero. The page does not sort keys and does not change numbers or strings. A syntax error is reported with a line and column, and no compact line is produced. The formatter's indent 0 writes this same string. Open the minifier when the question is the size.
Paste the pretty form, indent 2: { "color": "red", "count": 2 }
{"color":"red","count":2} The pretty paste is 34 bytes. The result is 25 bytes. The difference is 9 bytes.
The compact line is the payload, and the 34-to-25 comparison tells you what the indent was costing on this object.
The pretty form has newlines, two-space indents, and a space after each colon. Removing them takes {"color":"red","count":2} from 34 bytes to 25.
Key order is unchanged. Sort JSON keys alphabetizes every level. Minify only removes whitespace.
The result equals the paste when that line was already compact. The byte saving is zero.
The string is the same. The formatter is the control for 0, 2, 4, and 8 spaces. This page always returns the compact form so the size comparison is the point.
A trailing comma is a syntax error, so there is no output line. The message includes the line and column. Remove the comma and minify again.