JSON Escape / Unescape
Escape JSON to an embeddable string literal, or unescape a JSON string back to readable JSON.
What does Escape do?
Wraps your text in double quotes and escapes all special characters (", \, newlines, tabs) so the entire JSON can be safely embedded as a string value inside another JSON payload, a SQL query, or a Java/C# string literal.
Escape Example
Input JSON:
json
{"name": "Ravi Kumar", "city": "Surat"}Escaped output (safe to embed as a string value):
"{"name": "Ravi Kumar", "city": "Surat"}"Characters That Get Escaped
| Character | Escaped as | Why |
|---|---|---|
| " (double quote) | \" | Terminates string literals in JSON, Java, SQL |
| \ (backslash) | \\ | Escape character itself must be escaped |
| newline (\n) | \n | Control characters are not valid inside JSON strings |
| tab (\t) | \t | Same — control characters must be escaped |
| carriage return (\r) | \r | Windows line endings |
Common Use Cases
- ▸Embed JSON in SQL — Store a JSON payload in a VARCHAR column — escape it first to avoid quote conflicts.
- ▸Java / C# strings — Embed JSON as a String literal in source code — escaped form is copy-paste ready: String s = "{\"key\":\"val\"}".
- ▸Nested JSON payloads — Some APIs accept JSON-as-a-string inside another JSON field: {"body": "{"id":1}"}.
- ▸Debug API logs — API logs often contain double-escaped JSON — unescape to recover the original readable payload.