JSON escape and unescape
About JSON Escape / Unescape
Use this JSON escape and unescape tool to turn JSON into a quoted string literal, or to turn an escaped JSON string back into readable JSON. Escape mode adds the backslashes and quotes. Unescape mode removes them and pretty-prints the result.
It helps when JSON has to live inside something else: a Java, Go, C# or SQL string, a test fixture, or a JSON field that holds JSON. It also works as a quick JSON string serializer when you need the stringified form of a document.
Runs in your browser. Nothing is uploaded.
How it works
Escape mode
Escape mode first checks that the input is valid JSON. It then wraps the text in double quotes, turns each " into \", doubles every backslash, and writes newlines and tabs as \n and \t. This is the same output as JSON.stringify on the text, and you can paste it between quotes in most languages.
Unescape mode
Unescape mode does the reverse. Paste a quoted string that holds escaped JSON, like one copied from a log line or a stringified field. The tool resolves the escape sequences, checks that the result is valid JSON, and pretty-prints it.
Control and Unicode characters
Newlines, tabs and carriage returns use their short escapes. Other control characters become \uXXXX. Unescaping restores them exactly.
Switching direction
The Mode control switches between escape and unescape without clearing your input. Use it to check that a value round-trips.
Frequently asked questions
What is the difference between escaping and stringifying JSON?
They are the same idea. Escaping turns a JSON document into a single string value by quoting it and adding backslashes, so it can sit inside another string. Unescaping (sometimes called unstringifying) reverses it.
Why do I need to escape JSON at all?
When JSON sits inside another string, its quotes and backslashes break the outer syntax. That happens in code literals, SQL statements and JSON fields that hold JSON. Escaping makes it safe to embed.
How do I unescape a JSON string?
Switch Mode to unescape and paste the full string literal, including its outer double quotes, for example "{\"id\":1}". The tool decodes the escapes and shows the JSON pretty-printed. If the inner text is not valid JSON, it tells you why.
Does escaping change the data inside my JSON?
No. Escape mode keeps your text exactly, including its whitespace, and only adds quoting. Unescape mode returns the same data, pretty-printed with 2-space indentation.
Is my input sent to a server?
No. Escaping and unescaping run in your browser.
Why can't my escaped input be unescaped?
Unescape mode expects one valid JSON string literal wrapped in double quotes. Missing outer quotes, broken backslash sequences or inner text that is not JSON all cause an error that says which problem it hit.
Learn more
Sources & last verified
We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.
Found a wrong result or an outdated claim? Report an error and we will check it again.