JSON String Escape & Unescape
Escape text as a complete JSON string literal, or decode a quoted JSON string into plain text. Handle quotes, backslashes, tabs, newlines and Unicode without executing code.
Paste input or try the example.
JSON syntax only. Escaped output includes its outer double quotes. Unescape requires a complete JSON string, not a JavaScript expression or single-quoted literal.
Open a UTF-8 text file
Using JSON String Escape & Unescape
Escape text as a complete JSON string literal, or decode a quoted JSON string into plain text. Handle quotes, backslashes, tabs, newlines and Unicode without executing code.
- Paste your input, open a UTF-8 file or load the example.
- Choose the operation and settings, then click Convert string.
- Read the status and limitations, then copy or download the output.
Example
Line one A "quoted" value C:\demo\file.txt JSON syntax only. Escaped output includes its outer double quotes. Unescape requires a complete JSON string, not a JavaScript expression or single-quoted literal.
Questions & answers
Do I keep the surrounding quotes?
Yes. Escape produces a complete JSON string literal. Unescape expects those outer double quotes and rejects unquoted text or other JSON types.
Is JavaScript eval used?
No. The existing JSON syntax parser decodes strings without evaluating code. JavaScript single quotes, comments and expressions are not accepted.
Can I escape a JSON document?
The source is treated as text, so escaping a whole document produces one string containing that document. Use JSON Formatter if you want to format the object itself.
What limits apply?
Up to 250,000 source characters and 1,500,000 output characters. Newlines, tabs, quotes, backslashes and Unicode are handled; U+2028 and U+2029 are explicitly escaped.
Help improve this tool
Report a problem or suggest an improvement
Describe the issue without pasting private tool input. Feedback goes to our admin inbox.
