Paste text to begin.

What this tool does

JSON Escape converts plain text into a valid JSON string literal. That means quotes become escaped quotes, line breaks become \n, and backslashes are handled safely.

It is especially useful when a broken request body turns out to be a string-escaping problem rather than a structural JSON problem.

Common use cases

  • Preparing text for API request bodies.
  • Escaping fixture values in tests.
  • Embedding multiline content inside JSON.
  • Fixing logs or snippets that need JSON-safe strings.

Input and output example

Raw text

Hello "team"
Line two

Escaped JSON string

"Hello \"team\"\nLine two"

How to use this tool

  1. Paste raw text into the left panel.
  2. Click Escape for JSON.
  3. Copy the output and paste it into your JSON value.
  4. Use Unescape JSON String when you need to inspect an already escaped value.
Your text is processed in your browser and is not uploaded to our servers.

Common errors

  • Unescaped quotes can break an otherwise valid JSON body.
  • Raw line breaks inside JSON strings need to become escaped newline sequences.
  • Backslashes may need double escaping depending on the surrounding context.
  • Pasting plain text into the unescape action will fail unless it is a valid JSON string literal.

Related tools

FAQ

Does the escaped output include surrounding quotes?

Yes. The output is a valid JSON string literal.

Can I use this for multiline text?

Yes. Newlines are converted into JSON-safe escape sequences.

Why does unescape fail on some inputs?

The unescape action expects a valid quoted JSON string, not plain text.

Is this only for developers?

It is especially useful for developers, but anyone working with JSON string values can use it.