JSON Escape/Unescape
Escape and unescape JSON strings — 100% local processing
Input
Output
About JSON Escape/Unescape
To place text inside a JSON string, characters such as double quotes, backslashes, and line breaks must be escaped, for example \" and \n. Forgetting this is a frequent cause of invalid JSON, especially when embedding multi-line text or another JSON document inside a string.
This tool escapes text so it can be pasted into a JSON string value, and unescapes escaped text back to readable form, in your browser. It is handy for embedding payloads, SQL, or HTML inside JSON, and for reading escaped strings in logs.
Common use cases
- Embedding a multi-line message or code snippet inside a JSON value.
- Reading an escaped string from a log or API response.
- Putting a JSON document inside another JSON string.
- Fixing invalid JSON caused by unescaped quotes.
Frequently asked questions
- Which characters are escaped?
- Double quotes, backslashes, and control characters such as newlines and tabs.
- Why do I see \\n in my output?
- The text was escaped twice, so the backslash itself was escaped. Unescape once for each layer.
- Is this different from HTML escaping?
- Yes. JSON escaping uses backslashes; HTML escaping uses entities such as <. They serve different formats.