How to escape characters in JSON
The complete escape table, the difference between \u and \x, and why your backslashes vanish.
Inside a JSON string, the backslash starts an escape. The full set:
\" double quote \\ backslash \/ forward slash (optional) \b backspace \f form feed \n line feed (newline) \r carriage return \t tab \uXXXX Unicode code point (4 hex digits)
Why do my backslashes disappear?
If you write a JSON string in source code (e.g. JavaScript), you have to escape the backslash for both the host language and JSON. To get a literal \n in your JSON, write "\\\\n" in the source string.
Unicode beyond U+FFFF
Code points above U+FFFF use a surrogate pair: \uD83D\uDE00 encodes 😀. Modern parsers handle this automatically.