Format |
Null |
Booleans |
Integer |
Floating-point |
String |
Array |
Associative array/Object |
ASN.1 (BER, PER or OER encoding) |
NULL type |
BOOLEAN:
- BER: as 1 byte in binary form;
- PER: as 1 bit;
- OER: as 1 byte
|
INTEGER:
- BER: variable-length big-endian binary representation (up to 2^(2^1024) bits);
- PER Unaligned: a fixed number of bits if the integer type has a finite range; a variable number of bits otherwise;
- PER Aligned: a fixed number of bits if the integer type has a finite range and the size of the range is less than 65536; a variable number of octets otherwise;
- OER: one, two, or four octets (either signed or unsigned) if the integer type has a finite range that fits in that number of octets; a variable number of octets otherwise
|
REAL:
base-10 real values are represented as character strings in ISO 6093 format;
binary real values are represented in a binary format that includes the mantissa, the base (2, 8, or 16), and the exponent;
the special values NaN, -INF, +INF, and negative zero are also supported
|
Multiple valid types (VisibleString, PrintableString, GeneralString, UniversalString, UTF8String) |
data specifications SET OF (unordered) and SEQUENCE OF (guaranteed order) |
user definable type |
Bale[19] |
void
Encoded as zero bytes.
|
bool
True: 0x01 False: 0x00
|
Big-endian fixed size unsigned integers.
Big-endian two's complement signed integers.
Variable length unsigned integer with a compact encoding.
|
f32 , f64
Single and double precision big-endian floats.
|
string
Length-prefixed sequence of bytes.
|
Length-prefixed sequence of any type.
Fixed-length array.
|
Fixed size object, encoded as the concatenation of all members.
Key-value map of arbitrary size, encoded as an array of pairs.
|
Binn[20] |
\x00 |
True: \x01 False: \x02 |
big-endian 2's complement signed and unsigned 8/16/32/64 bits |
single: big-endian binary32 double: big-endian binary64 |
UTF-8 encoded, null terminated, preceded by int8 or int32 string length in bytes |
Typecode (one byte) + 1-4 bytes size + 1-4 bytes items count + list items |
Typecode (one byte) + 1-4 bytes size + 1-4 bytes items count + key/value pairs |
Bintoken[21] |
0x82 |
True: 0x81 False: 0x80 |
Single byte integers in the range [-32;127]
Fixed length integers for 8-bits, 16-bits, 32-bits, and 64-bits integers.
Encoded as two's complement little-endian values.
|
Little-endian IEEE single/double precision numbers. |
UTF-8 encoded type-length-value string. |
Balanced brackets with an optional array count. Arrays can be nested. |
Balanced brackets with an optional object count. Objects can be nested. |
BSON[22] |
Null type – 0 bytes for value |
True: one byte \x01 False: \x00 |
int32: 32-bit little-endian 2's complement or int64: 64-bit little-endian 2's complement |
double: little-endian binary64 |
UTF-8 encoded, preceded by int32 encoded string length in bytes |
BSON embedded document with numeric keys |
BSON embedded document |
Concise Binary Object Representation (CBOR)[23] |
\xf6 |
True: \xf5 False: \xf4 |
Small positive number \x00-\x17 , small negative number \x20-\x37 (abs(N) <= 23)
8-bit: positive \x18\xhh , negative \x38\xhh 16-bit: positive \x19<uint16_t> , negative \x39<uint16_t> 32-bit: positive \x1A<uint32_t> , negative \x3A<uint32_t> 64-bit: positive \x1B<uint64_t> , negative \x3B<uint64_t> Negative number x encoded as ~x (binary inversion) or as (-x-1) Byte order – Big-endian
|
Typecode (one byte) + IEEE half/single/double |
Typecode with length (like integer coding) and content.
Bytestring and UTF-8 have different typecode
|
Typecode with count (like integer coding) and items |
Typecode with pairs count (like integer coding) and pairs |
Efficient XML Interchange (EXI) |
xsi:nil element (1-4 bits depending on context) |
1 bit. |
0–12 bits (log2 range) bits for integers with defined ranges less than 4096. Extensible sequence of octets with infinite range for larger or undefined ranges. Also supports custom representations. |
Scalable floating point representation requiring 18 to 88 bits depending on magnitude. Also supports IEEE and custom representations. |
Length prefixed sequence of Unicode code points with partitioned string tables for efficient representation of repeated items. The length and code points are represented as variable length unsigned integers where values under 128 require 1 octet each. Also supports custom representations. |
Repeated elements or length-prefixed list of values. Also supports custom representations. |
Ordered (sequence) or unordered (all) group of named elements. |
Fast Binary Encoding[24] |
Encoded optional types:
null: \x00 value: \x01
|
Single byte boolean:
True: \x01 False: \x00
|
Little-endian encoded signed integer:
int8 , int16 , int32 , int64
Little-endian encoded unsigned integer:
uint8 , uint16 , uint32 , uint64
|
Little-endian encoded floats:
Little-endian encoded doubles:
Little-endian encoded decimals:
|
Single byte character:
Little-endian encoded 32 bit Unicode character:
UTF-8 encoded string, preceded by length (32 bit) in bytes:
|
Vector of any other type, preceded by its length (32 bit) and relative offset (32 bit)
- Fixed size array:
int32[10]
- Dynamic vector:
int32[]
- Linked list:
int32()
- Set:
int32!
|
Vector of (key, value) pairs, preceded by its length (32 bit) and relative offset (32 bit)
- Ordered map:
int32<string>
- Unordered hash table:
int32{string}
|
FlatBuffers[25] |
Encoded as absence of field in parent object |
True: one byte \x01 False: \x00 |
little-endian 2's complement signed and unsigned 8/16/32/64 bits |
floats: little-endian binary32
doubles: little-endian binary64
|
UTF-8 encoded, preceded by 32 bit integer length of string in bytes |
Vectors of any other type, preceded by 32 bit integer length of number of elements |
Tables (schema defined types) or Vectors sorted by key (maps / dictionaries) |
MessagePack |
\xc0 |
True: \xc3 False: \xc2 |
Single byte "fixnum" (values -32..127)
or typecode (one byte) + big-endian (u)int8/16/32/64
|
Typecode (one byte) + IEEE single/double |
Typecode + up to 15 bytes or typecode + length as uint8/16/32 + bytes; encoding is unspecified[26] |
As "fixarray" (single-byte prefix + up to 15 array items)
or typecode (one byte) + 2–4 bytes length + array items
|
As "fixmap" (single-byte prefix + up to 15 key-value pairs)
or typecode (one byte) + 2–4 bytes length + key-value pairs
|
Named Binary Tag |
|
|
|
|
|
|
|
Netstrings |
0:, |
True: 1:1,
False: 1:0,
|
|
|
|
|
|
OGDL Binary |
|
|
|
|
|
|
|
Property list (binary format) |
|
|
|
|
|
|
|
Protocol Buffers[27] |
|
|
Variable encoding length signed 32-bit: varint encoding of "ZigZag"-encoded value (n << 1) XOR (n >> 31)
Variable encoding length signed 64-bit: varint encoding of "ZigZag"-encoded (n << 1) XOR (n >> 63) Constant encoding length 32-bit: 32 bits in little-endian 2's complement Constant encoding length 64-bit: 64 bits in little-endian 2's complement
|
floats: little-endian binary32
doubles: little-endian binary64
|
UTF-8 encoded, preceded by varint-encoded integer length of string in bytes |
Repeated value with the same tag |
N/A |
Sereal |
0x25 |
True: 0x3b False: 0x3a |
Single byte POS/NEG (values -16..15)
or typecode (one byte) + "varint" encoded variable length integer or typecode (one byte) + "zigzag" encoded variable length integer
|
Typecode (one byte) + IEEE single/double/quad |
As "SHORT_BINARY" (single-byte prefix + up to 31 raw bytes)
or typecode (one byte, including boolean UTF8-encoding flag) + "varint" encoded length + raw bytes
|
As "ARRAYREF" (single-byte prefix + up to 15 array items)
or typecode (one byte) + "varint" encoded length + array items
|
As "HASHREF" (single-byte prefix + up to 15 key-value pairs)
or typecode (one byte) + "varint" encoded length + key-value pairs. Distinguishes hashmaps from objects / class instances.
|
Smile |
\x21 |
True: \x23 False: \x22 |
Single byte "small" (values -16..15 encoded using \xc0 - \xdf ),
zigzag-encoded varint s (1–11 data bytes), or BigInteger
|
IEEE single/double, BigDecimal |
Length-prefixed "short" Strings (up to 64 bytes), marker-terminated "long" Strings and (optional) back-references |
Arbitrary-length heterogenous arrays with end-marker |
Arbitrary-length key/value pairs with end-marker |
Structured Data eXchange Formats (SDXF) |
|
|
big-endian signed 24-bit or 32-bit integer |
big-endian IEEE double |
either UTF-8 or ISO 8859-1 encoded |
list of elements with identical ID and size, preceded by array header with int16 length |
chunks can contain other chunks to arbitrary depth |
Thrift |
|
|
|
|
|
|
|
VelocyPack[28] |
0x00 none,
0x18 null |
True: 0x1a False: 0x19 |
signed integers, little-endian, 1 to 8 bytes, 2's complement: 0x20 -0x27 + int;
unsigned integers, little-endian, 1 to 8 bytes: 0x28 -0x2f + uint; small integers 0, 1, ... 9: 0x30 -0x39 ; small negative integers -6, -5, ..., -1: 0x3a -0x3f ; UTC-date in milliseconds since the epoch, little-endian, 2's complement: 0x1c + uint64
|
double IEEE-754, little-endian: 0x1b + uint64 equivalent;
positive long packed BCD-encoded float: 0xc8 -0xcf + 8 bytes; negative long packed BCD-encoded float: 0xd0 -0xd7 + 8 bytes
|
UTF-8 string, 0–126 bytes length: 0x40 -0xbe + 0..126 bytes;
variable length UTF-8 string, little-endian, unsigned integer, not zero-terminated and may contain zero bytes: 0xbf + 8 bytes byte-length + string
|
empty array: 0x01 ;
array without index table, all sub items 1/2/4/8 bytes byte-length; array with 1/2/4/8 byte index table offsets, byte-length and number of sub values; compact array, no index table: 0x13
|
empty object: 0x0a ;
object with 1/2/4/8 byte index table offsets, sorted by attribute name, 1/2/4/8 byte byte-length and number of sub values; object with 1/2/4/8 byte index table offsets, not sorted by attribute name, 1/2/4/8 byte byte-length and number of sub values; compact object, no index table: 0x14
|