If you've ever hit Unexpected token in JSON at position 42 or Unterminated string, there's a good chance an unescaped character broke your payload. JSON is strict about what's allowed inside a string, and the fix is almost always escaping. Here's the practical version.
What does escaping a JSON string mean?
A JSON string is wrapped in double quotes. Any character that would confuse the parser must be replaced with a backslash escape sequence. Escaping doesn't change the meaning of your text — it just makes the string valid JSON so parsers can read it. Unescaping is the reverse: turning those sequences back into readable characters (handy when you copy a value out of logs or an API response).
The characters you must escape
JSON defines exactly seven characters that must be escaped inside a string:






