JSON Unstringify

Paste a quoted, escaped JSON string, even one still wrapped in a variable declaration, and get the real document back.

String literal
JSON
Runs locally in your browser

About the JSON Unstringify

Copying a payload out of a debugger, a stack trace or a source file usually brings the string literal along with it: an outer pair of quotes, a backslash before every inner quote, and sometimes a whole assignment such as const body = "...". This tool recognises that wrapper, removes it, resolves the escape sequences, and parses what is left so you can read the document.

Assignments in several languages are detected, including const, let, var, Java and C# string declarations, and a trailing semicolon is ignored. Single quoted and backtick delimited literals are handled as well as double quoted ones, which matters when the snippet came from JavaScript source rather than from JSON. Escapes that JSON itself does not define, such as \x41 and \', are resolved too, because code often contains them.

The unescaped text is then parsed, so the result is guaranteed to be a real document rather than text that merely looks like one. If the unescaping succeeds but the result is not valid JSON, the message says exactly that, along with the line and column, which usually means the copy was truncated in the middle.

Untick "Indent the result" when you want the compact document back for a request. To build a literal in the first place, use JSON to String, and for text that is escaped but is not a whole document, JSON Unescape is the simpler choice.

How to use

  1. Paste the string literal, with or without the surrounding declaration and semicolon.
  2. Read the JSON on the right. Indentation is on by default; untick it for the compact form.
  3. If the parse fails, check the reported line and column, which usually points at a truncated copy.
  4. Copy or download the recovered document.

Common questions

Can it handle a whole line copied from my source file?
Yes. A leading const, let, var or typed declaration and a trailing semicolon are recognised and removed before the string is unescaped.
What if the string uses single quotes or backticks?
All three delimiters are accepted, and escapes that only exist in JavaScript, such as \x hex escapes, are resolved as well.
Why do I get an error saying the result is not valid JSON?
The unescaping worked but the recovered text is not a complete document, usually because the copy was cut short or a fragment was taken from the middle.
Is this the same as the JSON Unescape tool?
No. Unescape returns whatever text was hidden by the escapes. This tool also strips the literal wrapper and insists the result parses as JSON.