JSON Escape/Unescape

Escape or unescape special characters in JSON strings

Mode:

Escape Sequences:

\" - Quote
\\ - Backslash
\n - Newline
\r - Carriage return
\t - Tab
\b - Backspace

About This Tool

JSON escaping is the process of converting special characters in strings to their escaped representations so they can be safely included in JSON. Characters like newlines, tabs, quotes, and backslashes must be escaped to maintain valid JSON syntax. Our tool handles both escaping (converting special characters to escape sequences) and unescaping (converting escape sequences back to special characters).

Common Escape Sequences

JSON uses backslash-based escape sequences for special characters. Double quotes (") become \" to avoid terminating strings prematurely. Backslashes (\) become \\ since backslash is the escape character itself. Newlines (\n) and carriage returns (\r) must be escaped to prevent breaking single-line string format. Tabs (\t) are escaped for consistent formatting. Form feeds (\f) and backspaces (\b) are also escaped though less commonly used.

When to Escape JSON

JSON escaping is essential when embedding JSON strings within other JSON structures, storing JSON in databases as string values, passing JSON as command-line arguments, including JSON in HTML attributes or JavaScript string literals, preparing JSON for transmission over protocols that require escaping, and creating JSON that contains multiline text, quotes, or special formatting. Proper escaping ensures your JSON remains valid and parseable.

Unescape for Readability

Unescaping JSON converts escape sequences back to their original characters, improving readability for human review. This is useful when examining JSON responses that contain escaped content, debugging JSON strings stored in databases, reviewing logs that contain escaped JSON, preparing JSON for display in user interfaces, and converting programmatically generated JSON back to readable format. Unescaping reveals the true content hidden behind escape sequences.