Escape quotes and new lines in JSON strings
Inside JSON strings, special characters must be escaped with backslashes.
{
"message": "She said: "hello"",
"path": "C:\temp\file.txt",
"multiline": "line one
line two"
}- \" for double quote
- \\ for backslash
- \n for newline
- \t for tab
If possible, avoid manual string building — use language JSON serializers to escape automatically.
Related: JSON formatter · Unexpected token fix
Continue with related guides
Browse the full guides hub or open the JSON formatter tool.