Skip to main content

String

RFC 8259 §7

"value"

A JSON string is a sequence of zero or more Unicode characters wrapped in double quotes. JSON strings support escape sequences for special characters: \" \\ \/ \b \f \n \r \t and \uXXXX for any Unicode code point. JSON strings must be UTF-8 encoded per RFC 8259.

Description

Strings in JSON are delimited by double quotes (not single quotes). Any Unicode character may appear inside a string except for characters that must be escaped: the double quote U+0022, the reverse solidus U+005C, and control characters U+0000 through U+001F.

The \uXXXX escape encodes a Unicode code point as four hexadecimal digits. Surrogate pairs (\uD800-\uDFFF) can represent supplementary characters. RFC 8259 recommends against emitting surrogate pairs but requires parsers to accept them.

Practical gotcha: JSON does not have a date or datetime type. Timestamps are conventionally represented as ISO 8601 strings (2026-01-15T10:00:00Z). JSON Schema adds format: date-time but core JSON has no such constraint.

Examples

LabelValue
Simple"Hello, world"
Empty string""
Escape sequences"Line 1\nLine 2\tTabbed"
Unicode"Caf\u00e9"
Backslash"C:\\Users\\alice"
Timestamp (convention)"2026-01-15T10:00:00Z"

Common Gotchas

!

Single-quoted strings are not valid JSON – only double quotes

!

Control characters (U+0000-U+001F) must be escaped even if the character is printable in the terminal

!

U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are valid unescaped in JSON but invalid in JavaScript string literals – relevant for JSON embedded in HTML/JS

!

JSON has no native datetime type – use ISO 8601 strings by convention

!

Large integers should be strings to avoid floating-point precision loss

See Also