About this tool
Embedding text containing newlines or quotes inside JSON requires escaping: `"` becomes `\"`, newline becomes `\n`, tab becomes `\t` and so on. Reversing that escaping is equally tedious.
This tool performs one-click escape and unescape using the browser's JSON engine, so the output is always spec-compliant. Escaping produces a value you can paste straight into a JSON string without the surrounding quotes.
How to use
- Paste raw text or a JSON string literal into the input.
- Click "Escape" or "Unescape".
- The result appears on the right.
- If unescape fails, check the input is a valid JSON string fragment.
Use cases
- Embed multi-line SQL, HTML or code into a JSON config.
- Recover readable text from a JSON string literal pasted from a log.
- Validate how a piece of text is represented inside JSON during debugging.
Notes
- Internally uses JSON.stringify / JSON.parse to ensure strict compliance.
- Unescape only accepts an input that could be the body of a JSON string.
- The escaped output has no surrounding quotes, ready to drop into a string field.
Frequently Asked Questions
Does the escaped output include surrounding quotes?
No. That lets you paste the result inside an existing JSON string.
Can it handle Unicode characters?
Yes. Unicode is preserved by default; a `\uXXXX` mode can be added if needed.
What if unescape reports a parse error?
Check for unescaped backslashes or stray double quotes in the input.