Most services use a JSON library, and most still have a corner that builds JSON by hand: a log line, an error body, an export. That corner breaks on the first customer whose name has a quote in it, or the first Windows path with a backslash.
This lesson builds the pieces carefully. A string literal needs its quotes, backslashes and control characters escaped. An object needs commas in the right places, null without quotes, and one value per key. An error body follows a fixed shape, so every client can read every failure the same way. And numbers from BigDecimal should be written in plain form, so 1E+2 appears as 100.
Each result is compared character for character, the way a client or a test would see it.
Every quote inside a value needs a backslash in front of it.