01What is JSON Escape Tool?
You have a chunk of text with quotes, line breaks and a Windows path in it, and it needs to sit inside a JSON string. Paste it raw and the parser chokes on the first stray quote. This tool does the escaping for you, and it can also run the process in reverse. The rules come from the JSON spec (RFC 8259, section 7). Inside a string, a double quote and a backslash must be escaped, and so must every control character below U+0020. In Escape mode the tool walks your input one character at a time. A double quote becomes \", a backslash becomes \\, and backspace, form feed, newline, carriage return and tab get their short forms: \b, \f, \n, \r and \t. Any other control character is written as a six-character \u escape with lowercase hex, so U+001F comes out as \u001f. Everything else passes through untouched. That includes accented letters, symbols and emoji, which the spec allows inside strings as plain UTF-8. Unescape mode reads the other way. It understands all of the standard escapes, including \/ for a forward slash. It turns \uXXXX into the matching character and joins a UTF-16 surrogate pair such as \ud83d\ude00 into one emoji. It is forgiving on purpose. An escape JSON does not define, like \x41, is left exactly as typed, and so is a \u with fewer than four hex digits. You get a readable result instead of an error. A quick example. Type He said "hi", press Enter, press Tab, then type C:\temp. Escape mode gives you He said \"hi\"\n\tC:\\temp. Each quote gains a backslash, the line break and tab become \n and \t, and the single path backslash is doubled. Switch to Unescape, feed that back in, and you get the original three lines of text. The output updates as you type, and both panes show a character count, which helps when a length limit matters. Your text is processed by a small function in the page itself, so it never leaves your browser tab. A few honest limits. The tool works on one string value, not a whole JSON document. It does not add the surrounding double quotes, so you add those where you paste the result. It also does not validate anything. Unknown escapes are kept rather than flagged, so a typo like \q slips through silently. And it leaves U+2028 and U+2029 alone, which is valid JSON but can break older JavaScript code that embeds the string in a script.
Backend and API developers who hand-edit JSON configs, fixtures and request bodies, or read escaped strings out of JSON logs. The tool runs entirely in your browser, so your data never leaves your device.
02How to use JSON Escape Tool
- Pick Escape (text → JSON string) or Unescape (JSON string → text) from the Mode dropdown
- Paste your text, or the escaped string without its outer quotes, into Input
- Read the converted result in Output and compare the character counts above each pane
- Click Copy, then wrap the escaped text in double quotes where you use it
- Click Reset to clear the input before the next string
03Worked examples
- Input:
Escape: He said "hi" + line break + tab + C:\temp - Result:
He said \"hi\"\n\tC:\\temp - Quotes, backslashes, newlines and tabs each become a two-character escape, so the path backslash is doubled.
- Input:
Escape: café ✓ + the control character U+0001 + 😀 - Result:
café ✓ \u0001 😀 - Accented letters, symbols and emoji stay as they are. Only the control character becomes a \u escape.
- Input:
Escape: a + CRLF line ending + b + U+001F - Result:
a\r\nb\u001f - Windows line endings become \r\n, and control characters without a short form use lowercase hex.
- Input:
Unescape: Line 1\nLine 2\u00e9 - Result:
Line 1 Line 2é - \n becomes a real line break and \u00e9 is decoded to é.
- Input:
Unescape: \ud83d\ude00 \u2764 \/path - Result:
😀 ❤ /path - The surrogate pair is joined into one emoji and the escaped slash becomes a plain slash.
- Input:
Unescape: bad \x41 and \u12 - Result:
bad \x41 and \u12 - \x is not a JSON escape and \u12 is too short, so both are left exactly as typed.
04Common use cases
- Embedding a multi-line SQL query or email template as a string value in a JSON config file
- Reading a stack trace that arrived as one long escaped line inside a JSON log entry
- Preparing a prompt full of quotes and newlines for the body of an LLM API request you are testing with curl
- Decoding \u escapes and surrogate pairs in an API response to see the actual characters and emoji
- Putting a Windows path like C:\Users\dev into a package.json script without the backslashes breaking the file
- Fixing a fixture file after a test fails because someone pasted raw text with a stray double quote
05Tips
- JSON has no single-quoted strings, so apostrophes never need escaping. Only double quotes and backslashes do.
- If a log shows \\n where you expected a line break, the string was escaped twice. Run Unescape twice to get the original back.
- Some serializers write \/ instead of / so the text can sit safely inside an HTML script tag. Unescape turns both forms into a plain slash.
- For a whole object, JSON.stringify in your own code is safer. This tool is meant for one string value at a time.
- Escape mode keeps emoji as real characters. If a downstream system only accepts ASCII, you will need a separate \u converter.
06Related concepts
escape sequences, JSON string literal, Unicode escapes, surrogate pairs, control characters.
Frequently Asked Questions
What is JSON Escape Tool?
JSON Escape Tool is a free, browser-based developer tool on AIDToolStack. Escape/unescape JSON strings It requires no installation or sign-up and works entirely in your browser.
Is JSON Escape Tool free to use?
Yes. No sign-up, no fees and no usage cap.
Does JSON Escape Tool store my data?
No. It runs in your browser; nothing is uploaded.