LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

🔧 JSON String Escaper / Unescaper

Turn raw text into a safe JSON string value — escaping ", \, newlines and tabs — or paste an escaped value to get the original text back.

escaped for a JSON string (\", \\, \n, \t, control chars, \uXXXX)

Rate this tool:
Anonymous — no account, no identifier

How the json string escaper / unescaper works

Escaping runs the text through the same rules a JSON serializer uses: the double quote, backslash, newline, carriage return, tab and other control characters are replaced with their backslash escapes (\", \\, \n, \r, \t, \uXXXX), so the result can be dropped between the quotes of a JSON string. Unescaping does the reverse by parsing the text as a JSON string literal, turning \n back into a real newline and \uXXXX back into its character.

Paste the text that goes *between* the quotes, not including the surrounding quotation marks. Unescaping fails if the text contains a bare (unescaped) double quote or a lone backslash, because that is not a valid JSON string body — escape it first, or fix the stray character.

Frequently asked questions

How do I escape a string for JSON?

Replace the special characters — double quote, backslash, newline, carriage return, tab and other control characters — with their backslash escapes (\", \\, \n, \r, \t). This tool does it for you: paste the raw text and choose Escape.

Which characters must be escaped in a JSON string?

The double quote (") and backslash (\) must always be escaped, along with the control characters U+0000–U+001F (newline, tab, etc.). Forward slashes and non-ASCII characters may be escaped but do not have to be.

How do I unescape a JSON string?

Choose Unescape and paste the escaped body (without the surrounding quotes). The tool parses it as a JSON string literal, so \n becomes a real newline, \" becomes a quote and \uXXXX becomes its character.

Why does unescaping fail?

A JSON string body cannot contain a bare double quote or a lone backslash — those must be escaped. If unescaping errors, the input has a stray " or \; escape it or remove it and try again.

Does it handle newlines and tabs?

Yes. Escaping converts real newlines to \n, carriage returns to \r and tabs to \t; unescaping turns them back into the actual whitespace characters.

Related developer tools