FastDevTool

JSON Escape / Unescape

Escape special characters in JSON strings, or unescape JSON escape sequences.

JSON String Escaping

JSON string escaping converts special characters to their escape sequences so they can be safely embedded in JSON. The backslash is the escape character: \" for quotes, \\ for backslashes, \n for newlines, \t for tabs.

This is necessary whenever you embed text that may contain these characters inside a JSON string value.

Common Escaping Scenarios

Escaping is needed when storing code snippets, HTML, or file paths inside JSON. Windows paths with backslashes (C:\Users\name) require escaping to C:\\Users\\name. HTML stored in JSON requires escaping angle brackets and quotes.

Many JSON serialization libraries handle escaping automatically, but manual escaping is sometimes needed for template strings or configuration values.

Related Tools

Frequently Asked Questions

What characters need to be escaped in JSON strings?

+

JSON strings must escape: double quotes ("), backslashes (\), and control characters (\n newline, \r carriage return, \t tab, \0 null). All other printable characters can be used as-is.

When do I need to escape JSON?

+

You need JSON escaping when embedding JSON inside another JSON string, storing JSON in SQL text fields, passing JSON in URL parameters, or including JSON in HTML attributes.