Developer Tools

Encoders / Escapers / Crypto

JSON Escape

Escape a string for embedding inside JSON.

String0 chars
String (escaped)

Guide & explanation

JSON Escape turns a plain string into a form that is safe inside a JSON string. The surrounding quotes are not added.

What gets escaped

  • " becomes \", \ becomes \\
  • newline becomes \n, tab becomes \t, carriage return becomes \r
  • other control characters become \u00XX

Example

Line 1
Then "quoted"

becomes one line:

Line 1\nThen \"quoted\"

The Unescape mode reverses the process; its input must be the contents of an already-escaped JSON string (not a whole JSON object).