JSON Escape & Unescape
Developer ToolsEscape text so it is a valid JSON string, or turn an escaped JSON string back into plain text.
Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy
About
What the JSON Escape & Unescape does
JSON Escape & Unescape converts between plain text and a JSON string literal. Escape adds backslashes before quotes and backslashes and writes line breaks and tabs as \n and \t, optionally wrapping the result in quotes and escaping non-ASCII characters. Unescape reverses it, reports invalid escapes with their position, and notices when a string was escaped twice.
Steps
How to use it
- 1Choose Escape or Unescape.
- 2Paste the text or the JSON string; surrounding quotes are optional when unescaping.
- 3Press the button, then copy the result; Swap sends it back the other way.
Example
A real run
Input
Order #1001 shipped. Carrier said: "Arrives Friday" TX
Output
Escaped: "Order #1001 shipped.\nCarrier said: \"Arrives Friday\"\tTX" Unescaped again: Order #1001 shipped. Carrier said: "Arrives Friday" TX
The line break becomes \n, the quotes around Arrives Friday become \", and the tab becomes \t. Unescaping the result gives back the original text exactly.
Options
Every setting, and when to use it
- Wrap in quotes
- On, the escaped text is a complete JSON string, ready to paste as a value. Off, you get only the inside, for pasting between quotes that are already there.
- Escape non-ASCII as \uXXXX
- Writes café as caf\u00e9 and an em dash as \u2014, for systems that only accept ASCII. JSON itself allows any Unicode character inside strings, so this is usually optional.
- Unescape until plain
- Strings copied from logs or nested payloads are often escaped twice, so one pass leaves \" behind. This repeats the unescape until no escapes remain.
Good to know
Common problems and limits
Input up to 5 MB. Unescape reports the first invalid escape, such as \q or a \u without four hex digits, with its character position.
Unescape is lenient about raw line breaks inside the input and keeps them as they are, because pasted strings often contain them.
This page works on one string at a time. To check or tidy a whole document, use the JSON Formatter or the JSON Validator.
Audience
Who uses it
- Backend developersPut a multi-line message, a SQL query or an HTML snippet into a JSON payload or a config value without breaking it.
- Support and operations teamsRead a stringified JSON blob from a log line or an error report as normal text.
- API testersBuild a request body containing a nested JSON string, the shape many webhook and queue APIs expect.
FAQ
Frequently asked
Which characters must be escaped in JSON?
Inside a JSON string, the double quote and the backslash must be escaped as \" and \\, and so must control characters such as line breaks and tabs, written \n, \r, \t or \uXXXX. The forward slash may be escaped as \/ but does not have to be. Everything else can appear as is.
Does JSON require double quotes?
Yes. JSON strings and object keys must use double quotes; 'single quotes' are invalid even though JavaScript accepts them. If a parser rejects your text for that reason, the JSON Validator can convert single quotes automatically.
How do I remove backslashes from a JSON string?
Unescape it: paste the string, choose Unescape, and \" becomes " and \n becomes a real line break. Do not delete backslashes with find and replace, because \\ means one literal backslash and \u00e9 means é.
Why does my JSON have JSON inside a string?
Some systems store or send a whole JSON document as a string value, for example a log line with a message field or an event payload in a queue. Unescape the string to get the inner JSON, then format it. If it still shows \", it was escaped twice: turn on Unescape until plain.
Is escaping the same as encoding?
No. Escaping only marks characters so they can sit inside a JSON string; the text is still readable. Encoding such as Base64 or URL encoding changes the whole representation for transport. For URLs, use URL encoding instead.
Is my text sent anywhere?
No. Escaping and unescaping happen in your browser. A copy of each run is saved to your past runs so you can reopen it.
Automation: an MCP tool json_escape(text), json_unescape(text) and an n8n node are planned for this tool.