>Fafa Dev Tools

JSON Escape/Unescape

Escape and unescape JSON strings. Handle newlines (\n), tabs (\t), quotes (\"), backslashes (\\) and Unicode. Free online JSON string escaper.

0 chars
Output will appear here...

What is JSON Escape/Unescape?

JSON string escaping converts special characters into their escape sequences so they can be safely embedded in JSON strings. For example, newlines become \n, tabs become \t, double quotes become \", and backslashes become \\. Unescaping does the reverse — converting escape sequences back into their actual characters.

How to Use

  1. Select Escape or Unescape mode using the buttons above the input
  2. In Escape mode: enter raw text with newlines, tabs, quotes — special chars become escape sequences
  3. In Unescape mode: enter text with escape sequences like \n, \t, \" — they become actual characters
  4. Use Swap to reverse the direction and work back and forth

Examples

Escape text with special characters

InputHello World "quoted"
OutputHello\nWorld\t\"quoted\"

Unescape a JSON string

InputPath: C:\\Users\\file.txt
OutputPath: C:\Users\file.txt

Frequently Asked Questions

Which characters are escaped?

The following characters are escaped: newline (\n), carriage return (\r), tab (\t), backspace (\b), form feed (\f), double quote (\"), backslash (\\). Control characters (ASCII 0-31) are escaped as \u00XX.

What's the difference between this and URL encoding?

JSON escaping handles special characters within JSON string values (\n, \t, \"). URL encoding handles special characters in URLs (%20, %3A). They serve different purposes — use JSON escaping when embedding text in JSON, and URL encoding when constructing URLs.

Does it handle Unicode escapes?

Yes. The unescape function handles \uXXXX Unicode escape sequences (e.g., \u0041 becomes 'A'). The escape function converts control characters (ASCII 0-31) to \uXXXX format but leaves other Unicode characters as-is for readability.