What minifying does and does not change
Only whitespace outside strings is removed. Everything inside a string, including spaces, tabs and escape sequences such as \n, stays as it is, and numbers are not reformatted, so a value like 12345678901234567890 comes out unchanged. Keys keep their order. The minified text parses to exactly the same data as the original.
The tool checks the JSON before minifying. If it is invalid, the errors are shown with their line and column and nothing is changed, because minifying broken JSON only hides where it is broken.
Minifying is not compression. A web server's gzip or Brotli shrinks JSON much further, and works on minified and pretty-printed JSON alike; minifying mainly helps when the text is stored or sent without compression, such as in a URL parameter, an environment variable, a database column or a test fixture.
Minifying JSON in your own code
In JavaScript, JSON.stringify(JSON.parse(text)) returns minified JSON, but it parses the numbers: integers beyond 9007199254740991 lose precision. In Python, json.dumps(json.loads(text), separators=(",", ":")) does the same job. On the command line, jq -c . file.json prints the minified document. To go the other way, use Format in the editor above.