Escape JSON strings

How to escape strings in JSON

JSON strings must be wrapped in double quotes, and certain characters must be escaped.

Characters that commonly need escaping

Example

{
  "message": "Line1\nLine2",
  "path": "C:\\\\temp\\\\file.txt",
  "quote": "She said: \"hello\""
}

Common mistakes

If your JSON won’t format, start here: Validate JSON.