Skip to main content

JSON String Escape / Unescape

Escape or unescape text for JSON, JavaScript, Java, C# and SQL string literals. Quotes, backslashes, new lines and Unicode handled. Private.

Text

Stays in your browser

Result

The result appears here.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JSON Parser or Encode / Decode.

Free Online JSON String Escape and Unescape

Turn text into a string you can put inside quotes in JSON or code, or turn an escaped string back into plain text. It gives developers a quick browser-based way to solve a focused json string escape / unescape task before moving the result into a project.

How to escape a string

Choose Escape or Unescape and the target language, then paste your text. The result updates as you type.

What is converted

Double quotes, backslashes, new lines, tabs and other control characters become backslash sequences. Non-English text and emoji stay as they are.

Worked example

The text He said "hi" followed by a line break becomes, for JSON:

He said \"hi\"\n

Common mistakes

  • Escaping twice doubles the backslashes. Unescape once to undo one round.
  • JSON does not allow \x41 or \': use \u0041 and a plain quote.

Frequently asked questions

What does escaping do?
It replaces characters that would end or break a string literal (quotes, backslashes, new lines, tabs) with a backslash sequence, so the text can sit safely between quotes in code or JSON.
Are the surrounding quotes added?
No. You get only the inside of the string, so you can paste it between your own quotes.
Why is SQL different?
In SQL a single quote inside a string is written as two single quotes (O''Brien). Backslashes are left alone.
Is my text uploaded?
No. It is converted in your browser.
How do I use this json string escape / unescape tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Code & Conversion

View all Code & Conversion tools →