JSON Escape / Unescape
Escape a string so it is safe to embed inside a JSON string value, or unescape a JSON-encoded string back to its original readable form.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON Escape / Unescape?
JSON string values have their own escaping rules. The following characters must be escaped with a backslash: double quote (\"), backslash (\\), and control characters including newline (\n), carriage return (\r), and tab (\t). Unescaped newlines and quotes inside a JSON string cause parse errors.
This tool escapes raw text into JSON-safe form, or reverses the process to recover the original string from a JSON-escaped value. Useful when manually constructing JSON, debugging serialisation output, or embedding multi-line strings in JSON configuration files.
How to Use JSON Escape / Unescape
Paste the string into the input field
Click "Escape for JSON" to make it safe for embedding inside JSON quotes
Click "Unescape from JSON" to convert a JSON-escaped string back to readable text
Copy the output for use in your JSON payload or config file
Common Use Cases
- Developers embedding multi-line SQL queries or code snippets as JSON string values in configuration files.
- API engineers manually constructing JSON request bodies where field values contain double quotes or backslashes.
- Support engineers copying error messages containing special characters into JSON-formatted log entries.
- QA testers verifying that a JSON serialiser correctly escapes all required characters in string values.
- Frontend developers embedding user-generated content inside JSON data attributes or inline script JSON blocks.
Example Input and Output
Escaping a multi-line SQL query so it can be embedded as a single JSON string value without breaking the JSON structure.
SELECT *
FROM "users"
WHERE name = "O'Brien"SELECT *\nFROM \"users\"\nWHERE name = \"O'Brien\"Wrap in quotes yourself
This tool escapes the content only. When embedding the result in JSON, remember to wrap it in double quotes: "your-escaped-value".
Browser-side only
All processing runs locally in your browser. No content is transmitted.

