JSON requires escaping double quotes (\"), backslashes (\\), and control characters including newline (\n), tab (\t), carriage return (\r), form feed (\f), and backspace (\b). Unicode characters can be escaped as \uXXXX.
You need to escape JSON when embedding it inside another string — for example, storing JSON in a database text field, passing it as a command-line argument, or embedding it in JavaScript string literals or log messages.
Escape converts special characters into their escape sequences (e.g., newline becomes \n). Unescape does the reverse — it interprets escape sequences and converts them back to their actual characters.