What JSON string escaping does

Inside a JSON string, a double quote ends the string and a backslash starts an escape, so both must themselves be escaped. Newlines, tabs and other control characters must be written as \n, \t and \uXXXX. This tool takes raw text and produces the escaped form you can paste into a JSON string, or reverses it.

Where this bites in practice

The classic failure is building a JSON payload by hand or by string concatenation and forgetting to escape a quote or a newline, producing JSON that will not parse. The same problem appears again with model output, where an LLM is asked to return JSON and emits an unescaped quote inside a string. Escape the value here, then validate.

Frequently asked questions

Which characters must be escaped in a JSON string?

A double quote, a backslash, and every control character below U+0020 (newline, tab, carriage return and so on). Everything else, including non-ASCII letters and emoji, may appear literally because JSON is UTF-8.

Do I need to escape non-English characters?

No. JSON is UTF-8 by default, so accented letters and emoji can appear as-is. Escaping them as \uXXXX is valid and sometimes necessary when the receiving system is not UTF-8 aware, but it makes the text much harder to read.

Is this the same escaping used for HTML?

No. HTML escaping replaces < and & with entities; JSON escaping deals with quotes, backslashes and control characters. They are different rule sets for different contexts and cannot be substituted for one another.

Is my text sent anywhere?

No. Escaping and unescaping happen locally in your browser, so payloads containing credentials or customer data stay on your machine.

Related tools