>Fafa Dev Tools

JSON String Escape/Unescape

Escape and unescape strings for JSON. Handle newlines, quotes, backslashes, and tabs. Free online JSON string escape tool.

0 chars
Output will appear here...

What is JSON String Escape/Unescape?

JSON string escaping converts special characters into escape sequences that are valid inside JSON string values. Characters like newlines become \n, double quotes become \", and backslashes become \\. This is necessary because JSON strings are delimited by double quotes and cannot contain literal control characters.

How to Use

  1. Select Escape or Unescape mode
  2. In Escape mode: paste raw text with newlines, quotes, and special characters
  3. In Unescape mode: paste a JSON-escaped string to see the original text
  4. Use Swap to reverse the direction

Examples

Escape for JSON

InputLine 1 Line 2 "quoted"
OutputLine 1\nLine 2\t\"quoted\"

Unescape JSON string

InputHello\nWorld\\path\t!
OutputHello World\path !

Frequently Asked Questions

What characters need escaping in JSON?

Double quotes ("), backslash (\), and control characters: newline (\n), carriage return (\r), tab (\t), backspace (\b), form feed (\f). Forward slashes (/) may optionally be escaped. All other characters can appear literally.

Is this the same as URL encoding?

No. URL encoding uses %XX format for special characters in URLs. JSON escaping uses backslash sequences for special characters in JSON string values. They serve different purposes and produce different output.

Does this validate JSON syntax?

No. This tool only handles string-level escaping/unescaping. It does not validate or format entire JSON objects. Use the JSON Formatter tool to validate and format complete JSON documents.