Blog
Wild & Free Tools

JSON Escape Special Characters β€” The Complete Reference

Last updated: April 2026 6 min read
Quick Answer

Table of Contents

  1. The Complete Escape List
  2. Required vs Optional Escapes
  3. Unicode Escape Patterns
  4. Common Misconceptions
  5. Serializer Behaviors
  6. Frequently Asked Questions

JSON's escape rules are short β€” there are exactly nine recognized escape sequences. Anything else is invalid and will trigger a parse error. This is the complete reference: every escape, when it's required, and when it's optional.

The Complete List of Valid JSON Escapes

EscapeMeaningWhen required
\"Double quoteAlways inside strings
\\BackslashAlways inside strings
\/Forward slashOptional β€” JSON allows raw / too
\bBackspace (U+0008)Always (raw control char invalid)
\fForm feed (U+000C)Always
\nNewline (U+000A)Always
\rCarriage return (U+000D)Always
\tTab (U+0009)Always
\uXXXXAny unicode characterRequired for U+0000 through U+001F (other than the named ones above)

Notice what's NOT on the list: \' (single quote escape β€” JSON doesn't have one because single quotes are not delimiters), \a (bell β€” common in C, not in JSON), \v (vertical tab β€” also from C), \x41 (hex escape β€” JSON uses \uXXXX instead), \0 (null β€” use \u0000).

Any backslash followed by anything outside the valid list is a parse error.

Required vs Optional Escapes

Required means JSON syntax is invalid without the escape.

Optional means the escape is allowed but the raw character is also allowed.

The required escapes inside a string are:

Optional escapes:

Most serializers escape only what's required and leave optional characters raw. The output is shorter and equally valid.

Sell Custom Apparel β€” We Handle Printing & Free Shipping

The Unicode Escape Pattern

Any character can be expressed as \u followed by four hex digits. The hex digits give the Unicode code point.

CharacterCode pointEscape
AU+0041\u0041
Γ©U+00E9\u00e9
β™ U+2660\u2660
δΈ­U+4E2D\u4e2d

For characters above U+FFFF (most emoji, some CJK extensions), JSON uses UTF-16 surrogate pairs β€” two \u escapes:

CharacterCode pointEscape
πŸ˜€U+1F600\uD83D\uDE00
πŸ‘U+1F44D\uD83D\uDC4D

This surrogate-pair behavior is inherited from JavaScript's UTF-16 string representation. Most consumers handle it transparently β€” you rarely need to construct surrogate pairs by hand.

Common Misconceptions About JSON Escapes

Myth: JSON requires escaping forward slashes.

It doesn't. The spec allows \/ as an optional escape. Most serializers leave forward slashes raw. The exception is some HTML-embedding contexts where escaping / as \/ prevents the string </script> from breaking out of a script tag.

Myth: JSON requires escaping non-ASCII characters.

It doesn't. JSON is UTF-8 by spec. Raw Γ©, δΈ­, πŸ˜€ are all valid inside strings. Some legacy serializers escape them as \u for safety; modern ones leave them raw.

Myth: JSON supports the same escapes as JavaScript strings.

Mostly but not entirely. JavaScript supports \v, \0, \x41, single-quote escape, and others that JSON doesn't. Pasting a JS string literal into a JSON document can produce invalid JSON if any of these slipped in.

Myth: \u escapes need uppercase hex.

Either case works. \u00E9 and \u00e9 are both valid. Some serializers prefer one or the other; the parser doesn't care.

How Different Serializers Handle These Rules

Most serializers escape the same things β€” quote, backslash, control characters β€” but differ on the optional cases. Quick reference:

SerializerEscapes /Escapes non-ASCII
JavaScript JSON.stringifyNoNo
Python json.dumps (default)NoYes (use ensure_ascii=False to disable)
PHP json_encode (default)Yes (use JSON_UNESCAPED_SLASHES to disable)Yes (use JSON_UNESCAPED_UNICODE to disable)
Go json.MarshalNoNo (HTML-safe escapes <, >, &)
.NET System.Text.JsonNo (in non-HTML mode)No (in non-HTML mode)
Java JacksonNoNo

The result is equivalent JSON in all cases β€” just different verbosity. If you're comparing JSON output across implementations and the bytes don't match, optional escape choices are usually the reason.

Check Your JSON Escapes

Paste your JSON to escape or unescape per the rules in this reference.

Open Free JSON Escape / Unescape Tool

Frequently Asked Questions

Does JSON support the \' escape for single quotes?

No. Single quotes are not string delimiters in JSON, so they need no escape. \' is invalid.

Why does my JSON have \u escapes for normal characters like Γ©?

Some serializers default to escaping non-ASCII (Python json.dumps, PHP json_encode). Both forms are valid; the raw form is usually preferred for readability.

How do I escape an emoji in JSON?

Either leave it raw (preferred) or use the surrogate pair: πŸ˜€ becomes \uD83D\uDE00.

Can I escape any character with \u, even if there's a shorter escape?

Yes. \u0009 and \t both produce a tab. The shorter form is preferred for readability but both are valid.

David Rosenberg
David Rosenberg Technical Writer

David spent ten years as a software developer before shifting to technical writing covering developer productivity tools.

More articles by David →
Launch Your Own Clothing Brand β€” No Inventory, No Risk