Developer Tools
JSON Escape / Unescape
Escape text into a JSON string or unescape a JSON string back to text.
Free foreverRuns in your browserNo sign-up
Escape turns text into a safe JSON string body (newlines, tabs and quotes become \n, \t and \"). Unescape reverses it.
About the JSON Escape / Unescape
When you embed text inside a JSON string, special characters like quotes, backslashes, newlines and tabs must be escaped, or the JSON becomes invalid.
This tool escapes any text into a safe JSON string body, and unescapes an escaped string back into the original text.
It runs entirely in your browser, so your data stays private.
Key features
- Escape text to a JSON string body
- Unescape back to raw text
- Handles quotes, newlines, tabs and unicode
- Local, private processing
How to use
- 1Choose Escape or Unescape.
- 2Paste your text.
- 3Copy the result.
Examples
Escape a multi-line string
Input:
Line 1\nLine 2Output:
Line 1\\nLine 2The newline becomes \n so the text is safe inside a JSON string.
Frequently asked questions
- What characters get escaped?
- Double quotes, backslashes and control characters such as newlines and tabs become their escape sequences (\", \\, \n, \t), so the result is a valid JSON string body.
- Does it add the surrounding quotes?
- No. It returns the escaped body without the outer quotes, so you can drop it straight into a JSON string.
- Why does unescape show an error?
- If the input is not a valid escaped string (for example a stray backslash), it cannot be parsed. Fix the escape sequences and try again.
