EthicalFusion

JSON String Unescaper

Decode an escaped JSON string back into readable text with real line breaks.

Was this tool helpful?

Thanks for the feedback!

The JSON String Unescaper takes a string full of escape sequences such as \n, \t and \" and shows the text they represent, with real line breaks, tabs and quotes. It is built for reading values pulled out of logs, API responses and config files, where multi-line text has been squeezed onto one line.

Examples

Input "Line one\nShe said \"hi\"" gives:

Line one
She said "hi"

A value from a JSON log, "Error at line 3:\n\tat com.shop.Cart.add(Cart.java:42)", turns back into a readable two-line stack trace with its tab indent. Unicode escapes are converted too, so ₹500 becomes ₹500, and an escaped slash \/api becomes /api.

Supported escape sequences

EscapeBecomes
\n, \rline feed, carriage return
\ttab
\", \\, \/" and \ and /
\b, \fbackspace, form feed
\uXXXXthe Unicode character with that hex code

These are the only escapes JSON allows. Sequences borrowed from other languages, such as \x41 or \a, make the input invalid and produce an error.

With or without the outer quotes

The tool first tries to read your input as a complete JSON string, quotes included. If that fails, it adds the quotes itself and tries again, so you can paste just the inside of the value. Spaces and line breaks around the input are trimmed first. One case still needs the quotes: text that ends with an escaped quote, like She said \"hi\", because the final " looks like a closing quote. Wrap it in quotes and it decodes correctly.

When you get an error

  • You pasted a whole object. {"a":1} is JSON, but not a string. Copy only the string value you want to read.
  • The text contains a bare quote. She said "hi" without backslashes is not an escaped string; it is already plain text.
  • An invalid escape such as \x or a single backslash before an ordinary letter is present. In a Windows path, each backslash must be doubled.

Text that was escaped twice

If the result still shows \n as two visible characters, the value was escaped twice, which happens when JSON is stored inside another JSON string. For example "a\\nb" decodes to a\nb, not to two lines. Paste the output back in and unescape it again. The work happens in your browser, so log lines with internal details stay on your machine. To go the other way, use the JSON String Escaper; to read a whole document rather than one value, use the JSON Formatter.

Frequently asked questions

Do I need to include the surrounding quotes?
Usually not; the tool adds them if they are missing. If your text ends with an escaped quote, include the outer quotes to avoid an error.
Why do I still see \n in the result?
The string was escaped twice. Run the output through the unescaper a second time.
Can it decode \u escape codes?
Yes. Any \uXXXX sequence becomes its character, so ₹ turns into the rupee sign.
Why does my string give an error?
It may contain an escape JSON does not allow, such as \x, an unescaped double quote, or a whole JSON object instead of a single string value.
What is this useful for?
Reading stack traces, email bodies or messages stored in JSON logs and API responses, where line breaks appear as \n.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.