Escape / Unescape a JSON String

Escape free-form text to insert it into a valid JSON string (quotes, line breaks, tabs...), or unescape an already-escaped JSON string to get back the original text.

Example:

How it works

When you want to insert free-form text — written by a user, extracted from a document, pasted from another program — inside a JSON configuration file, the quotes, line breaks or tabs it contains immediately break the file's structure if pasted as-is. This tool automatically escapes these special characters (quotes ", backslash \, line breaks \n, tabs \t, etc.) to get a string ready to be pasted between two quotes in any valid JSON file, or does the reverse to read back an already-escaped text.

Why doesn't my JSON parse after pasting text?

A single unescaped quote, or a raw line break inside a JSON string, is enough to make the whole document invalid for a strict parser. This is the most common error when building a configuration file or a translations file by hand rather than generating the JSON programmatically.

Should I escape the entire text or only certain characters?

Escaping processes the whole string at once: all characters that have a special meaning in JSON are converted, the rest stay unchanged. You can therefore paste any text, including multi-line text, without having to manually spot the problematic characters.

Privacy: processing happens entirely in your browser via WebAssembly — your text is never sent to a server.