JSON String Escaper
Escape text into a valid JSON string literal, or unescape a JSON string back to plain text. Handles quotes, backslashes, newlines and Unicode.
Last reviewed by the Radiatus Cloud team
Escape text into a JSON string literal, or unescape a JSON string back to text.
Need this built for your product?
We design, build & host secure software & APIs.
Escape text into a JSON string
Putting arbitrary text inside a JSON string requires escaping certain characters: double quotes and backslashes must be prefixed with a backslash, and control characters such as newlines and tabs become their escape sequences. This tool does it reliably using the same rules as a standards-compliant JSON encoder. Paste any text and it produces a valid JSON string literal, complete with surrounding quotes, ready to embed in a JSON document or source code. It also works in reverse, unescaping a JSON string back to the original plain text.
This removes the guesswork and the subtle errors that come from escaping strings by hand.
When to escape JSON strings
Developers constantly need to embed snippets of text, HTML, SQL or other JSON inside a JSON value, whether writing fixtures, crafting API request bodies, or building configuration. Any stray quote or newline would otherwise break the JSON, so correct escaping is essential. Unescaping is equally handy for reading a value pulled from a JSON payload or log.
Because the tool uses the browser's native JSON encoder and decoder, the output is guaranteed to be valid and matches what every conforming JSON parser expects. All processing happens locally in your browser, so your text stays private.
Related tools
- JSON Formatter — Format and beautify JSON in your browser. Pinpoints syntax errors by line and column, flags unsafe integers, and never uploads your data to a server.
- JSON Validator — Validate JSON syntax with precise line and column errors, and check documents against a JSON Schema. Runs locally in your browser, nothing uploaded.
- Regex Tester — Test regular expressions against sample text with live match highlighting, capture groups and flag control. Runs entirely in your browser.
- HTML Minifier — Minify HTML by removing comments and redundant whitespace, without breaking inline elements or pre blocks. Runs entirely in your browser.
Frequently Asked Questions
What characters get escaped?
Double quotes and backslashes are escaped, and control characters such as newlines, tabs and carriage returns become their backslash escape sequences.
Does the output include the surrounding quotes?
Yes. Escaping produces a complete JSON string literal with the enclosing double quotes, ready to drop straight into JSON or code.
Can it unescape a JSON string?
Yes. Paste a JSON string, with or without the surrounding quotes, and the tool parses it back into the original plain text.
Is the escaping standards-compliant?
Yes. It uses the browser\'s native JSON encoder, so the result is valid JSON that every conforming parser accepts.
How are non-ASCII characters handled?
They are kept as-is in valid UTF-8 JSON, which is standard. If you need pure ASCII output, follow up with a Unicode escape tool.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Paste text to escape it as a JSON string, or a JSON string to unescape it.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.
Related Tools
JSON Formatter
DeveloperFormat and beautify JSON in your browser. Pinpoints syntax errors by line and column, flags unsafe integers, and never uploads your data to a server.
JSON Validator
DeveloperValidate JSON syntax with precise line and column errors, and check documents against a JSON Schema. Runs locally in your browser, nothing uploaded.
Regex Tester
DeveloperTest regular expressions against sample text with live match highlighting, capture groups and flag control. Runs entirely in your browser.