JSON Escape / Unescape

Convert text to an escaped form safe to embed in code strings, or revert it

How to use

Escaping turns double quotes, backslashes and newlines into \" \n form, so a JSON snippet can be written as a string inside code or nested in another JSON. Unescape is the reverse.

FAQ

Why is there an extra layer of quotes after escaping?

Because a JSON string must be wrapped in quotes. That layer of quotes is exactly the marker that it can be embedded as a string. Remove the quotes and it is no longer a valid string.

What if unescaping fails?

Make sure the input is a complete JSON string literal including the surrounding quotes. If only the inner content is pasted, the tool tries to treat it as a string; if it still fails, the content itself is invalid.