{ } JSON Workbench0 network requests. Check DevTools

"JSON Escape":{ }

JSON escape converts special characters in a string into valid JSON escape sequences so the text can be embedded inside a JSON string without breaking parsing. Quotes, backslashes, newlines, tabs and control chars become their escaped forms. Runs 100% in your browser.

What is JSON escaping?

JSON strings are delimited by double quotes, so any ", \, or control character inside them must be escaped or the parser breaks. JSON escape converts special characters into valid escape sequences: quotes, backslashes, newlines, tabs and control chars become \", \\, \n, \t, and so on.

It's essential when embedding user text, Windows paths, multiline logs, or stack traces inside a JSON payload. Everything runs 100% in your browser.

Edge cases & gotchas

  • Output is the escaped body only, not a quoted literal (no surrounding "). Use Stringify if you want the quotes too.
  • Invalid escapes like \q or \x are not valid JSON; only the defined sequences below are legal.
  • Literal (raw) newlines and tabs are illegal inside JSON strings. They must become \n / \t.
  • Forward slash is left unescaped by default (valid); some tools force \/.
  • Backslash is escaped first (\\) to avoid mangling other sequences.
  • Repair-aware parsing tolerates messy input on the unescape round-trip.

Escape sequence reference

SequenceCharacterMeaning
\""Double quote
\\\Backslash
\//Forward slash (optional)
\nLFNewline / line feed
\tTABHorizontal tab
\rCRCarriage return
\bBSBackspace
\fFFForm feed
\uXXXXanyUnicode code point, 4-digit hex

How to use

  1. Paste your raw text into the Input pane.
  2. The escaped body renders live in the Output pane.
  3. Copy the escaped string content, ready to drop between quotes in a JSON value.
  4. To reverse it, use Unescape. To wrap a value into a full quoted string literal, use Stringify.

Examples

Quotes + newline + tab (edge case)

Input
He said "hello"
Line 2	tabbed
Output
He said \"hello\"\nLine 2\ttabbed

Windows path (backslash)

Input
C:\Users\Name\file.txt
Output
C:\\Users\\Name\\file.txt

Unicode / control char

Input
©
Output
\u00a9

FAQ

Escape vs stringify: what's the difference?

Escape outputs only the escaped string body (no surrounding quotes). Stringify wraps a full JSON value in double quotes and escapes it, producing a complete string literal.

Do forward slashes need escaping?

No. \/ is legal JSON but optional; / is valid unescaped, so we leave it as / by default.

How do I escape Unicode?

Non-ASCII and control characters can be emitted as \uXXXX with 4-digit hex. Emoji and characters above U+FFFF need surrogate pairs (two \uXXXX).

Why do I get "Unexpected token" errors?

Usually a raw newline or an unescaped " inside a string. Escape the text first so those become \n and \".

What about double escaping?

Extra backslashes (\\n where you wanted \n) mean the text was escaped twice. Unescape once to fix it.

Is my data uploaded?

No. Escaping runs entirely client-side: zero network requests, verifiable in DevTools.

Related tools