Category: Developer tools
JSON String Escape
Convert text to and from a JSON-safe string literal
Turn raw text into a JSON-safe string literal, with quotes, backslashes and control characters escaped, or decode a JSON string literal back into the text it represents. Runs entirely in your browser.
"A \"quoted\" line\nwith a tab\there and a backslash \\ too."
Everything on this page is processed in your browser. Nothing is uploaded.
What this tool does
Pasting a multi-line log line or a snippet with quotes straight into a JSON config or API payload breaks the file the moment a stray quote or newline lands in the wrong place. This tool uses the same escaping rules the JSON standard defines to turn any text into a literal that is safe to drop into a JSON document, and the reverse: paste a literal, with or without its surrounding quotes, to get the original text back.
How to use it
- Choose Escape to convert raw text, or Unescape to decode a literal.
- Paste or type into the input box.
- Copy the result from the output box.
Privacy
This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.
Frequently asked questions
- Is my text uploaded anywhere?
- No. Escaping and decoding happen in JavaScript running in the page, so nothing you paste ever leaves your device.
- Do I need to include the surrounding quotes when unescaping?
- No. A literal is accepted with or without its outer double quotes; either way it is parsed as a single JSON string.
- What happens if the literal is invalid?
- A message explains what the JSON parser rejected, such as an unterminated string or a bad escape sequence, instead of failing silently.