Dad’s Data formats tools

JSON Escape / Unescape

Escape strings for embedding in JSON, or unescape back to raw form. 100% local.

Raw String Input
Escaped Output
Paste a string to escape it for use in JSON.

Escape Sequences

The JSON specification requires certain characters inside string values to be represented as two-character backslash sequences. The table below lists every mandatory and common optional sequence.

SequenceCharacterWhen it appears
\"Double quoteInside a JSON string value containing "
\\BackslashWindows paths like C:\Users\alice
\/Forward slashOptional; most parsers accept unescaped /
\nNewlineMulti-line string content
\rCarriage returnWindows line endings inside strings
\tTabIndented content inside string values
\uXXXXUnicodeAny character outside safe ASCII
Warning: Escaping a JSON string value (one field inside a document) and escaping an entire JSON document so it can be stored as a string are two different operations. This tool escapes the entire input as a single string — it does not walk the JSON tree and escape individual values.

When Do You Need to Escape?

You need to escape a string for JSON in these common situations:

• Embedding JSON inside another JSON string — e.g., a config value that is itself a serialized JSON document.

• Storing JSON in a database column that uses double quotes as string delimiters and does not support a native JSON type.

• Constructing JSON manually in shell scripts where " is the string delimiter and unescaped quotes would break the syntax.

String with a newline character — escaped for JSON
Before escape:
{"message": "Hello\nWorld!"}

After escape:
{"message": "Hello\\nWorld!"}

Try It

Interactive — edit the input to see the output update
Try it
Result

Frequently Asked Questions

Your files stay on your computer. Dad promised.

Data formats tools

Search the Data formats tools