What does unescaping JSON do?
When text is stored inside a JSON string, special characters are written as backslash sequences:
\n for a newline, \" for a quote, \u00e9 for é. Unescaping reverses that.
It turns the sequences back into the characters they stand for, so you can read the content or parse it again.
You'll typically need this when a log line, a message queue payload, or a database column contains JSON that was
saved as a string. It looks like "{\"orderId\":42,\"items\":[...]}", which is hard to
read and impossible to query until it's unescaped.
Features
- With or without quotes: paste
"..."or just the inner content. - Double-escape detection: strings that were serialized two or three times are unwrapped layer by layer, and the tool tells you how many layers it removed.
- Auto pretty-print: if the result is valid JSON, it's formatted with 2-space indentation.
- Precise errors: invalid escape sequences are reported with their line and column.
- Unicode aware:
\uXXXXescapes and emoji surrogate pairs are decoded correctly.
Example: unescaping a logged payload
"{\"event\":\"signup\",\"user\":{\"name\":\"Zoë\",\"plan\":\"pro\"},\"note\":\"line1\nline2\"}"
{
"event": "signup",
"user": {
"name": "Zoë",
"plan": "pro"
},
"note": "line1\nline2"
}
Escaped vs. double-escaped
| Layers | Looks like | How to read it |
|---|---|---|
| 0 (plain JSON) | {"a":"b"} | Already usable |
| 1 | "{\"a\":\"b\"}" | Parse once |
| 2 | "\"{\\\"a\\\":\\\"b\\\"}\"" | Parse twice |
Each layer doubles the backslashes before it. If you control the producer, fix the root cause. It's almost always a
JSON.stringify or json.dumps call on a value that was already a JSON string.
How to unescape JSON in code
JavaScript
// One layer of escaping
const escaped = '"{\\"id\\":1,\\"name\\":\\"Ada\\"}"';
const json = JSON.parse(escaped); // '{"id":1,"name":"Ada"}' (a string)
const obj = JSON.parse(json); // { id: 1, name: 'Ada' } (an object)
// Unwrap any number of layers
function deepParse(value) {
while (typeof value === 'string') {
try { value = JSON.parse(value); } catch { break; }
}
return value;
}
Python
import json
raw = '"{\\"id\\": 1, \\"name\\": \\"Ada\\"}"'
inner = json.loads(raw) # '{"id": 1, "name": "Ada"}'
data = json.loads(inner) # {'id': 1, 'name': 'Ada'}
Command line (jq)
# Parse a JSON-encoded string field from the command line
echo '{"payload":"{\"id\":1}"}' | jq '.payload | fromjson'
Need the opposite direction? Use the JSON Escape tool.
Frequently asked questions
How do I unescape a JSON string?
Paste the escaped string, with or without its surrounding double quotes, into the tool above in Unescape mode. Escape sequences like \n, \t, \" and \uXXXX are converted back into the real characters. If the result is valid JSON, it is pretty-printed automatically.
How do I fix double-escaped JSON?
Double-escaped JSON has backslashes before backslashes, e.g. {\\\"a\\\":1}. Keep "Auto-detect double escaping" enabled and the tool removes layers repeatedly until it reaches the real JSON. In code, call JSON.parse (or json.loads) once per layer.
Why do I get "Invalid escape sequence"?
JSON only allows these escapes: \" \\ \/ \b \f \n \r \t and \uXXXX. Anything else, such as \x41 or \', is invalid. These usually come from JavaScript or Python string literals rather than real JSON. The error message shows the exact line and column.
How do I decode \u escapes like \u00e9 or \ud83d\ude00?
\uXXXX is a UTF-16 code unit in hexadecimal. \u00e9 is é. Characters outside the Basic Multilingual Plane, like most emoji, use two escapes called a surrogate pair: \ud83d\ude00 is 😀. This tool decodes both forms.
Is it safe to paste production logs here?
Yes. Unescaping happens locally in your browser. No input is uploaded, logged or stored on any server.