Skip to content

JSON Unescape

Unescape a JSON string back to readable text in your browser. Decodes \n, \t, \", \\, and \uXXXX, with or without surrounding quotes. 100% private, no upload.

No Tracking Runs in Browser Free
0 chars
Decoded Text
0 chars
Reviewed for JSON spec decoding, quote-optional parsing, surrogate-pair reconstruction, and malformed-input error handling — Go Tools Engineering Team · Jun 10, 2026

What is JSON Unescaping?

JSON unescaping is the reverse of JSON escaping: it takes a string full of escape sequences — \n, \t, \", \\, \uXXXX — and turns each one back into the character it represents, recovering the original text. Where escaping makes a string safe to store inside a JSON document, unescaping makes a stored string readable again.

The need shows up constantly in debugging and data work. You copy a field out of a structured log and it is full of \n and \" that hide the real message — unescaping reveals the actual multi-line text. An API stored a request body as a string (JSON-in-JSON), and you need to read the inner object — unescaping turns {\"a\":1} back into {"a":1}. A legacy system emitted ASCII-safe output where every accent became \uXXXX — unescaping restores café and résumé. In each case the data is technically intact but unreadable until decoded.

This tool is built for that decode path with three advantages. First, it is lenient about the surrounding quotes: paste a full literal or just the escaped body, and it does the right thing — because escaped strings are usually copied out of context. Second, it decodes \uXXXX correctly, combining surrogate pairs into proper astral characters like emoji, identical to a compliant JSON parser, so anything escaped by a serializer round-trips perfectly. Third, it runs 100% in your browser, so the log fields and payloads you decode — which often contain PII or secrets — never reach a server. To re-escape afterward, use our JSON Escape tool; to validate the decoded JSON, see the JSON Formatter.

// Escaped input (copied from a log, quotes optional)
User said: \"it works!\"\nSession ended.

// Unescaped output — readable again
User said: "it works!"
Session ended.

// \uXXXX and surrogate pairs decode too
caf\u00e9 \ud83d\ude00  ->  café 😀

// JSON-in-JSON
{\"a\":1}  ->  {"a":1}

Key Features

Full JSON Escape Decoding

Decodes the complete set of JSON escapes — \n \r \t \b \f \" \\ \/ and \uXXXX — back to their real characters, identical to a compliant JSON parser. Anything a serializer escaped comes back byte for byte.

Quotes Optional

Paste a complete string literal with surrounding quotes, or just the escaped body without them — the tool detects which and decodes correctly. Ideal for strings copied out of the middle of a log or document.

Correct Unicode & Emoji

\uXXXX escapes decode to their Unicode characters, and consecutive surrogate escapes combine into the right astral character — \ud83d\ude00 becomes 😀, \u00e9 becomes é. No mangled code points.

Clear Error Reporting

Malformed input — a lone backslash before an unrecognized character, or an unbalanced quote — surfaces an explicit error banner instead of silently producing garbage, so you know exactly what to fix.

Swap for Round-Trip Verification

One Swap direction button flips into escape mode in place and re-encodes the decoded text, letting you confirm unescape → escape returns the original string before you trust the result.

100% Browser-Based Privacy

All decoding runs client-side — the log fields and payloads you unescape (often containing PII or secrets) never leave the browser. Verify it in the Network tab: zero requests on paste.

Examples

Escaped string copied from a log

"User said: \"it works!\"\nSession ended."

A JSON-escaped log field with \" and \n. Unescape it to read the real two-line message with actual quotes — exactly what was logged.

Read a JSON-in-JSON payload

{\"event\":\"signup\",\"user\":{\"id\":42}}

An inner JSON object stored as an escaped string. Unescaping reveals the real JSON so you can read or re-parse it. No surrounding quotes needed — they are added automatically.

Decode \uXXXX Unicode escapes

caf\u00e9 \ud83d\ude00 r\u00e9sum\u00e9

ASCII-safe escapes from a legacy system. Unescape turns \u00e9 back into é and the surrogate pair \ud83d\ude00 back into 😀.

Restore a multi-line snippet

function greet(name) {\n  return \"Hi \" + name;\n}

A code snippet that was flattened into a single JSON string. Unescaping restores the real newlines so it is readable and runnable again.

How to Use

  1. 1

    Paste the escaped string

    Enter or paste a JSON-escaped string — with or without its surrounding double quotes. The decoded text appears instantly. Click 'Load example' to try a sample like an escaped log line or a \uXXXX-encoded string.

  2. 2

    Read the decoded output

    Escape sequences become real characters: \n turns into line breaks, \" into quotes, and \uXXXX into Unicode. If the input is malformed, an error banner explains the problem so you can fix the offending backslash.

  3. 3

    Copy or verify the result

    Click Copy to grab the readable text, or send it to the JSON Formatter to validate. Click Swap direction to re-escape it in place and confirm the round-trip matches your original.

Common Decoding Pitfalls

Invalid Escape Like \q or \x41

JSON only recognizes \n \r \t \b \f \" \\ \/ and \uXXXX. A backslash before anything else — \q, or a C-style \x41 — is not a valid escape and decoding fails. Replace \x41 with \u0041, and remove stray backslashes that were meant to be literal (a literal backslash must be written \\).

✗ Wrong
value: \q and \x41
// \q and \x hex are not valid JSON escapes -> error
✓ Correct
value: \\q and \u0041
// literal backslash doubled; hex written as \u -> decodes

Unbalanced Quotes in Unescaped Input

When you paste a bare body (no outer quotes), the tool wraps it in quotes before decoding. If the body itself contains an unescaped double quote, the wrapping breaks and decoding fails. Escape interior quotes as \" or paste the fully-quoted literal instead.

✗ Wrong
say "hi" there
// interior unescaped " breaks auto-wrapping -> error
✓ Correct
say \"hi\" there
// interior quotes escaped -> decodes to: say "hi" there

Expecting a Literal Backslash That Was Not Doubled

A single backslash in the input is interpreted as the start of an escape. If you actually wanted a literal backslash (e.g. a Windows path), it must appear doubled as \\. A lone \ before a normal letter triggers an invalid-escape error.

✗ Wrong
path: C:\Users\Alice
// \U and \A are invalid escapes -> error
✓ Correct
path: C:\\Users\\Alice
// doubled backslashes -> decodes to C:\Users\Alice

Common Use Cases

Decode Structured Log Fields
Copy a message field full of \n and \" out of a JSON log line and unescape it to read the real multi-line message exactly as it was emitted, instead of squinting at escape sequences.
Read JSON-in-JSON Payloads
Turn an inner JSON object that was stored as an escaped string field back into real JSON, so you can read it or paste it into a parser — common in webhook envelopes and audit logs.
Restore Unicode from ASCII-Safe Output
Decode \uXXXX-heavy output from a legacy system back into accented letters, CJK characters, and emoji, recovering the human-readable form of data that was forced to pure ASCII.
Un-flatten Code Snippets
Convert a script or query that was collapsed into a single JSON string (every newline as \n) back into properly formatted, multi-line, readable code.
Debug Double-Encoded Data
When a value looks like \\n or \\\", unescape once to inspect whether it was accidentally escaped twice upstream, then fix the producer — a frequent integration bug.
Inspect API Error Messages
Many APIs return error details as escaped strings inside a JSON envelope. Unescape the message to read stack traces and nested payloads that are otherwise hidden behind escape sequences.

Technical Details

Decoding Algorithm
The tool parses the input as a JSON string: if it is already wrapped in double quotes it is decoded as-is, otherwise the raw input is wrapped in quotes first so a bare escaped body still decodes. Each recognized escape (\n \r \t \b \f \" \\ \/ \uXXXX) maps to its character; this mirrors a compliant JSON parser, guaranteeing that any serializer-escaped string returns to its exact original.
Surrogate Pair Reconstruction
A \uXXXX escape yields a single UTF-16 code unit. When a high surrogate (\uD800–\uDBFF) is immediately followed by a low surrogate (\uDC00–\uDFFF), the two are combined into one code point above the Basic Multilingual Plane — so \ud83d\ude00 decodes to the single character 😀 rather than two broken halves.
Validation and Error Handling
If the input contains an invalid escape (a backslash followed by an unrecognized character, or a malformed \u sequence) or unbalanced quotes that break wrapping, decoding fails cleanly and an error banner is shown rather than emitting corrupted output. Valid input always produces the exact decoded string; invalid input never produces a misleading partial result.

Best Practices

Paste With or Without Quotes — Both Work
Do not waste time trimming surrounding quotes. The tool decodes "hello\nworld" and hello\nworld identically, so paste whatever you copied — including a fragment lifted from the middle of a larger document — and read the result.
Unescape Once, Then Check for Double-Encoding
If the decoded output still shows backslash sequences like \n, the original was double-escaped upstream. Unescape a second time to confirm, then fix the producer so it escapes only once rather than relying on repeated decoding.
Validate the Decoded JSON
After unescaping a JSON-in-JSON payload, run the result through our JSON Formatter to confirm it is valid and to pretty-print it. Unescaping recovers the text; the formatter confirms the structure.
Verify Round-Trips with Swap
Click Swap direction to re-escape the decoded text and check it matches the string you started with. A mismatch points to a malformed input or an unexpected escape, surfacing data problems before they propagate.

Frequently Asked Questions

What does this JSON unescape tool do?
It reverses JSON escaping: it takes a JSON-escaped string and decodes the escape sequences back into the characters they represent, entirely in your browser. \n becomes a real newline, \t a tab, \" a double quote, \\ a single backslash, \/ a forward slash, and \uXXXX the corresponding Unicode character (including surrogate pairs for emoji and astral scripts). The result is the original, human-readable text. You can paste the string with or without its surrounding double quotes — the tool detects and handles both. Everything runs client-side, so escaped payloads containing sensitive data never leave your machine.
Do I need to include the surrounding double quotes?
No — the tool accepts both forms. If you paste a complete JSON string literal like "hello\nworld" (with the outer quotes), it is parsed directly. If you paste just the escaped body hello\nworld (no outer quotes), the tool wraps it for you before decoding. This is convenient because escaped strings are often copied out of the middle of a larger document, where the surrounding quotes were left behind. Either way you get the same decoded text.
Is my data uploaded anywhere?
No. All decoding runs entirely in your browser using JavaScript — the escaped string you paste is never transmitted, stored, logged, or analyzed on any server. This makes the tool safe for decoding log fields, webhook payloads, and config values that may contain PII or secrets. You can confirm it in your browser's Network tab: pasting triggers zero network requests. No cookies capture your input and no third-party analytics read what you paste.
Why do I get an 'invalid escape sequence' error?
The error means the input is not a valid JSON-escaped string, so it cannot be decoded unambiguously. The most common cause is a lone backslash followed by a character JSON does not recognize as an escape — for example \q or \x41 (JSON has no \x hex escape; it uses \u). Another cause is an unbalanced or stray double quote inside an unquoted input, which breaks the automatic wrapping. Check that every backslash starts a valid escape (\n \t \r \b \f \" \\ \/ \uXXXX) and that quotes are properly paired.
How do I read a JSON object that was stored as a string (JSON-in-JSON)?
Paste the escaped string — for example {\"a\":1} — and the tool decodes it back to the real JSON {"a":1}, which you can then read or copy into a parser. This double-decoding is exactly what you need when a webhook envelope, message-queue record, or audit log stored a request body as an escaped string field. After unescaping, paste the result into our JSON Formatter to pretty-print and validate it. To go the other direction and escape JSON for embedding, use the JSON Escape tool.
Does it correctly decode \uXXXX and emoji?
Yes. Each \uXXXX is decoded to its UTF-16 code unit, and consecutive high/low surrogate escapes are combined into the correct astral character — so \ud83d\ude00 becomes 😀 and \u00e9 becomes é. This is the same decoding any compliant JSON parser performs, which means a string escaped by our JSON Escape tool (or any serializer) round-trips back to the exact original here, byte for byte.

Related Tools

View all tools →