Escape \" / \ / newline / tab / Safe JSON string embedding

InputSample
chars: 0
Output
chars: 0

What Is JSON Escaping?

JSON escaping is the process of converting special characters in your text into JSON-safe escape sequences. The JSON standard does not allow double quotes ", backslashes \, and control characters such as line breaks to appear literally inside a string—they must be replaced with escape sequences (for example, \" for a double quote, \\ for a backslash, and \n for a newline). Escaped text can then be safely embedded in a JSON string and recognized correctly by any standard JSON parser. To reverse the process and restore the original characters, use the JSON Unescaper tool.

Common Use Cases

API construction: when a JSON field value contains double quotes or line breaks, escape it before embedding, otherwise the parser will fail. Config development: JSON config strings often include Windows paths with backslashes; escaping them prevents load failures. Multiline text: log messages, user input, and other multiline text must escape line breaks and tabs when embedded into a JSON string. Code generation: pre-escape uncertain content when generating JSON strings so special characters cannot break the JSON structure. After escaping, review the overall structure with the JSON Formatter, or run the JSON Validator to confirm it is valid.

Frequently Asked Questions

Does JSON escaping change my data?

No. Escaping only replaces special characters in the original text with their escape sequences (for example, " → \"), so the meaning stays the same. Escaping is reversible—unescaping restores the original text.

What is the difference between escaping and unescaping?

Escaping turns special characters in text into sequences such as \n and \" so they can be stored safely inside a JSON string. Unescaping turns those sequences back into the original characters. They are inverse operations, handled by the JSON Unescaper tool and this page respectively.

Which characters need to be escaped?

In JSON, the characters that must be escaped include double quotes " → \", backslash \ → \\, line break → \n, carriage return → \r, tab → \t, backspace → \b, form feed → \f, plus Unicode control characters such as \u0000.

How do I handle double quotes inside a JSON string?

Escape every inner " as \" so the outer JSON quotes remain intact. For example, the text He said "hi" becomes He said \"hi\" after escaping, which can then be embedded correctly as a JSON string value.