JSON & Schema

JSON Escape Characters Explained: Quotes, Backslashes, Newlines, and Unicode

JSON strings use a backslash to represent quotes, backslashes, control characters, and Unicode code units that cannot appear literally in the string syntax.

Published

JSON escape characters at a glance

EscapeMeaning
\"Double quote
\\Backslash
\/Slash
\b / \fBackspace / form feed
\n / \r / \tNewline / carriage return / tab
\uXXXXUTF-16 code unit

Quotes and backslashes

The first layer protects syntax-significant characters inside a JSON string.

\"quoted\" and C:\\temp

Newlines, tabs and control characters

JSON string syntax uses escapes for line breaks, tabs, and other controls; raw control characters are not valid inside the quoted string.

Unicode escapes with \uXXXX

A single BMP character can use one escape. Characters outside that range are represented by a valid UTF-16 surrogate pair.

Price: \u20AC 10

JSON string literal vs JSON document

Escaped text may be the contents of one JSON string rather than an entire object or array. After unescaping, use a parser only when the result is supposed to be a complete JSON document.

Why JSON becomes double escaped

Logging, database storage, or an outer API string can serialize already escaped text again. Inspect one layer at a time to avoid decoding beyond the intended boundary.

Invalid escapes and common mistakes

  • Using single quotes as JSON delimiters.
  • Leaving a stray final backslash.
  • Writing an incomplete \u escape.
  • Embedding a raw line break inside a quoted JSON string.

Unescape vs parse

Unescape converts string escape sequences. Parsing additionally requires a complete JSON grammar and produces structured data.

Try escape and unescape examples

Use the static examples to observe the tool's actual one-layer output and diagnostics.

Try the example

Decode newline and quote escapes

One unescape layer turns the visible escape sequences into text characters.

Hello\n\"world\"

Expected result: The output contains a line break followed by "world".

Try the example

Decode a Unicode escape

The four hexadecimal digits identify the euro sign code unit.

Price: \u20AC 10

Expected result: The output is Price: € 10.

Try the example

Remove one escaped JSON layer

The escaped quotes become ordinary quotes after one explicit unescape.

{\"name\":\"Ada\"}

Expected result: One unescape produces {"name":"Ada"}.

Decode one layer

Inspect escaped JSON text

Run static examples locally and compare one-layer results.

Open in JSON Unescape →