Escape text for insertion inside a JSON string value.
Quotation marks, reverse solidus, and control characters are represented with string escape sequences inside a quoted value; other Unicode characters may remain literal UTF-8. The escaped text is then part of a JSON string token, not a standalone JavaScript expression.
Line 1 Line 2 "quoted"
Line 1\nLine 2\t\"quoted\"
API payloads, newline-containing logs, and parser fixtures escape JSON strings.