JSON Escape / Unescape

  • Backspace is replaced with \b
  • Form feed is replaced with \f
  • Newline is replaced with \n
  • Carriage return is replaced with \r
  • Tab is replaced with \t
  • Double quote is replaced with \"
  • Backslash is replaced with \\
Character Count: 0 | Word Count: 0 | Sentence Count: 0 | Line Count: 0

JSON escape and unescape: fix quotes inside JSON strings

JSON escape turns plain text into a safe string literal—backslashes, quotes, and control characters become escape sequences so the result can sit inside a larger JSON document. Unescape reverses that when you copied an over-escaped value from a log or API payload.

This is narrower than JSON.stringify on an entire object: you are working on the string contents that belong between quotes, which is exactly what you need when building config templates or debugging `"message"` fields.

How to use this converter

  1. Paste the raw text or escaped fragment into the input.
  2. Choose Escape to produce `\n`, `\"`, and `\t` sequences, or Unescape to read the original.
  3. Copy the output into your JSON file, Postman body, or code generator.

Before and after examples

OriginalConvertedNotes
She said "hi"She said \"hi\"Interior quotes
line1\nline2line1 line2Unescape newlines

Escape vs JSON.stringify vs manual quoting

`JSON.stringify("hello")` wraps the whole value in quotes and escapes interior characters. This tool focuses on the interior when you already have opening and closing quotes in a template. Manual escaping is error-prone—one missed backslash before a newline breaks the entire file.

Common escapes include `\"` for quotes, `\\` for backslashes, `\n` for newlines, and `\uXXXX` for Unicode code points when needed.

API bodies, env files, and CI secrets

When a deployment platform expects JSON in an environment variable, multiline private keys and PEM blocks must be escaped. Paste the secret, escape here, then place the result inside the JSON string value. For reading, unescape a log line that doubled every backslash.

Do not commit escaped secrets to public repos—treat output like the original plaintext for security purposes.

Frequently asked questions

Does this validate full JSON documents?

No. Use the JSON Formatter for objects and arrays. This page handles string fragments.

What about Unicode emoji?

They can be escaped to \u sequences or left as UTF-8 depending on your target parser. Test in your consumer.

Guides and deeper reading