JSON Escape / Unescape
Escape text for use inside a JSON string, or unescape a JSON string back to plain text — quotes, backslashes, newlines and control characters.
About this result
What It Does
This tool escapes arbitrary text so it is valid inside a JSON string: double quotes and backslashes get a backslash, line breaks and tabs become \n and \t, and other control characters become \u escapes. It uses the same escaping rules as the JSON spec, so the result is accepted by every parser. Switch direction to unescape a JSON string body back into plain text.
When to Use It
- You are hand-writing a JSON fixture and a value contains quotes or a Windows path.
- You need to put an error message, a stack trace or a snippet of HTML into a JSON field.
- You are reading a JSON string full of \n and \" and want the real text.
- Text pasted from a PDF or a terminal contains invisible control characters breaking your JSON.
Worked Examples
She said "hi" and left.
The two double quotes become \" — the only change needed.
C:\Program Files\App
Each backslash doubles. An unescaped backslash before P or A would be an invalid escape, and the whole document would fail to parse.
Line one\nLine two\t(tabbed)
The reverse: \n becomes a real line break and \t a real tab.
Features
How to Use
1. Paste your input into the top box. 2. Adjust the options if the page has any — the result updates as you type. 3. Read the notes under the result, then copy it.
Common Mistakes
- Editing the result by hand and breaking the escaping. If you need to change the content, change the input and run it again — a single stray backslash makes the whole value invalid.
- Assuming the browser preserved Windows line endings. A pasted CRLF becomes LF in any text box, so a byte-exact comparison with the original file can still differ.
- Trusting that two documents are equal because they look equal. Key order, whitespace and number formatting differ between serializers; compare parsed values, not text.
Frequently Asked Questions
Related Tools
Everything runs in your browser. Your JSON is never uploaded, logged or stored.