Binary
Binary values written as Base64 byte strings.
A binary value is a sequence of raw bytes carried as text. It is written as a Base64 byte string: the prefix b followed by Base64 content in single or double quotes. Binary values suit images, encrypted content, cryptographic keys, or any arbitrary byte sequence in an otherwise text-based document.
The content between the quotes is Base64 per RFC 4648. Base64 is the encoding; binary is the value type.
Implementation status (beta). Binary literals are not yet available in the reference implementation:
b'…'andb"…"currently raise a syntax error (unexpected-token), and nobinaryschema type is registered. This page documents the intended design; the examples below are illustrative and are not yet executable. Track progress in the Roadmap.
Syntax
A binary value is prefixed with b and enclosed in single or double quotes; the content must be valid Base64.
binaryValue = "b" (singleQuotedBase64 | doubleQuotedBase64)
singleQuotedBase64 = "'" base64Content "'"
doubleQuotedBase64 = '"' base64Content '"'
base64Content = { base64Character }
base64Character = "A"…"Z" | "a"…"z" | "0"…"9" | "+" | "/" | "="Structural characters
b
Byte prefix
U+0062
Marks the value as a Base64 byte string
'
Single quote
U+0027
Encloses the Base64 content
"
Double quote
U+0022
Encloses the Base64 content
A–Z, a–z, 0–9
Base64 alphabet
—
Base64 data characters
+, /
Base64 alphabet
U+002B, U+002F
Base64 data characters
=
Padding
U+003D
Base64 padding
Valid forms
Invalid forms
Without quotes there is no annotation at all, so nothing announces a binary literal and the text is an ordinary open string:
Behavior
Whitespace — leading and trailing whitespace around the quotes is ignored; whitespace inside the Base64 content is not allowed.
Prefix case — the prefix MUST be lower-case
b; the Base64 content is case-sensitive.Padding — standard
=padding is required for correct decoding.Decoding — a parser decodes the content into a byte sequence (commonly a byte array or buffer) and preserves the exact bytes; invalid Base64 is a parse error.
Internet Object does not interpret the structure of the decoded bytes — any format, compression, or application meaning is the application's concern.
See Also
Value Representations — all value types
Binary — the binary schema type
Strings — text values (open, regular, raw)
Last updated
Was this helpful?
