Xerobit

JSON Unescape: Decode Escaped JSON Strings

Paste an escaped JSON string to decode all backslash sequences including \n, \t, \\, \" and \uXXXX hex codes. The tool accepts input with or without surrounding double quotes and reports clear errors for invalid escapes. Everything runs locally in your browser so nothing is uploaded.

Paste a JSON string literal. Surrounding double quotes are optional.

Result

How to use the json unescape

  1. Paste your escaped JSON string into the text area. You can include or omit the surrounding double quotes.
  2. The tool automatically decodes every escape sequence as you type or paste.
  3. Copy the unescaped plain text from the result box below.
  4. If the input contains an invalid escape like \x, a clear error message explains what went wrong.

How JSON unescape works

A JSON string literal uses the backslash character to encode special characters that cannot appear directly in the source text. When you json unescape a value, each two-character sequence starting with a backslash is replaced by the single character it represents.

The standard escape sequences defined by the JSON specification (RFC 8259) are:

  • \" becomes a double quote
  • \\ becomes a single backslash
  • \/ becomes a forward slash
  • \b becomes a backspace
  • \f becomes a form feed
  • \n becomes a line feed (newline)
  • \r becomes a carriage return
  • \t becomes a horizontal tab
  • \uXXXX becomes the Unicode character at the given hexadecimal code point

This tool wraps your input in double quotes if they are missing, then delegates to the native JSON.parse function. That guarantees full compliance with the specification, including correct handling of surrogate pairs for characters outside the Basic Multilingual Plane.

Surrogate pairs and Unicode

Characters above U+FFFF, such as most emoji, are encoded in JSON as two consecutive \uXXXX sequences called a surrogate pair. For example, the grinning face emoji is written as \uD83D\uDE00. The first value (D83D) is the high surrogate and the second (DE00) is the low surrogate.

When you unescape json strings containing these pairs, the parser combines them into a single character. A lone surrogate without its partner is technically invalid according to the JSON specification, and JSON.parse will reject it with an error. This strict behaviour prevents malformed data from passing through silently.

If you need to convert decoded JSON data into other formats, tools like json to xml or json formatter handle the resulting Unicode text correctly.

Common mistakes when decoding JSON strings

Several pitfalls cause errors during a json unescape operation:

  • Missing closing quote. If your input starts with a double quote but does not end with one, the parser treats it as an unterminated string and throws an error.
  • Invalid escape characters. Sequences like \x or \a do not exist in JSON. Only the nine sequences listed above are valid.
  • Incomplete hex codes. A \u must be followed by exactly four hexadecimal digits. Writing \u41 instead of \u0041 will fail.
  • Double escaping. If a string was escaped twice during transport, running the unescape operation once will leave residual backslashes. You may need to run it again on the output.

The error messages produced by this tool point out exactly which rule was broken so you can fix the source data quickly.

Practical use cases

Developers frequently encounter escaped JSON strings in log files, API responses, database records and configuration files. A common scenario is reading a JSON payload that has been serialised inside another JSON string, resulting in nested escapes like "{\"name\":\"Ada\"}". Decoding the outer layer reveals the inner JSON object.

Another frequent case involves debugging raw HTTP traffic where newline characters appear as \n rather than actual line breaks. Pasting that traffic through a json unescape tool restores readable formatting instantly.

For structured data conversion after decoding, you might pass the clean JSON through json to html table or json to markdown table to generate documentation or reports.

Reference table of JSON escape sequences

The following table lists every valid escape sequence recognised during a json unescape operation, along with its Unicode code point and description.

EscapeCode PointDescription
\"U+0022Double quotation mark
\\U+005CReverse solidus (backslash)
\/U+002FSolidus (forward slash)
\bU+0008Backspace
\fU+000CForm feed
\nU+000ALine feed (newline)
\rU+000DCarriage return
\tU+0009Horizontal tab
\uXXXXU+XXXXUnicode character at hex value XXXX

The forward slash escape (\/) is optional in JSON. It exists so that the string </script> can be safely embedded inside HTML script tags without prematurely closing the block.

Worked examples

ExampleInputResult
Newlines and tabsEscaped JSON string: "Line 1\nLine 2\tTabbed"Line 1 / Line 2 Tabbed
Unicode emoji surrogate pairEscaped JSON string: "\uD83D\uDE00"😀
Without surrounding quotesEscaped JSON string: Hello\nWorldHello / World
Nested JSON objectEscaped JSON string: "{\"key\":\"value\"}"{"key":"value"}

FAQ

Do I need to include the double quotes around my string?

No. If you omit the surrounding double quotes, the tool adds them automatically before parsing. If you include them, they are used as-is.

What happens if the input contains an invalid escape like \x?

The tool displays a clear error message indicating that the escape sequence is not valid JSON. Only the nine standard escape sequences are accepted.

Can this tool decode Unicode surrogate pairs?

Yes. Sequences like \uD83D\uDE00 are combined into the correct single Unicode character, such as an emoji, using the standard JSON parsing rules.

Is my data sent to a server when I use this tool?

No. The json unescape operation runs entirely in your browser using JavaScript. Nothing is uploaded or transmitted over the network.

Why does my string still have backslashes after decoding?

The original data may have been double-escaped. Try pasting the output back into the tool to remove a second layer of escaping.

Does this work for entire JSON objects or only strings?

This tool is designed for individual JSON string literals. If you paste a full JSON object, wrap it in quotes so it is treated as a string, or use a dedicated JSON formatter instead.