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 221024 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: 1, 2, or 4 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 |
BSON | \x0A(1 byte) | True: \x08\x01False: \x08\x00(2 bytes) | 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) | \xf6(1 byte) | (1 byte) | - Small positive/negative \x00–\x17 & \x20–\x37 (1 byte)
- 8-bit: positive \x18, negative \x38 (+ 1 byte)
- 16-bit: positive \x19, negative \x39 (+ 2 bytes)
- 32-bit: positive \x1A, negative \x3A (+ 4 bytes)
- 64-bit: positive \x1B, negative \x3B (+ 8 bytes)
- Negative x encoded as (−x − 1)
| - IEEE half/single/double \xf9–\xfb (+ 2–8 bytes)
- Decimals and bigfloats (4+ bytes) encoded as \xc4 tag + 2-item array of integer mantissa & exponent
| - Length and content (1–9 bytes overhead)
- Bytestring \x40–\x5f
- UTF-8 \x60–\x7f
- Indefinite partial strings \x5f and \x7f stitched together until \xff.
| - Length and items \x80–\x9e
- Indefinite list \x9f terminated by \xff entry.
| - Length (in pairs) and items \xa0–\xbe
- Indefinite map \xbf terminated by \xff key.
|
Efficient XML Interchange (EXI) (Unpreserved lexical values format) | xsi:nil is not allowed in binary context. | 1–2 bit integer interpreted as boolean. | Boolean sign, plus arbitrary length 7-bit octets, parsed until most-significant bit is 0, in little-endian. The schema can set the zero-point to any arbitrary number. Unsigned skips the boolean flag. | - Float: integer mantissa and integer exponent.
- Decimal: boolean sign, integer whole value, integer fractional.
| Length prefixed integer-encoded Unicode. Integers may represent enumerations or string table entries instead. | Length prefixed set of items. | Not in protocol. |
FlatBuffers | Encoded as absence of field in parent object | (1 byte) | Little-endian 2's complement signed and unsigned 8/16/32/64 bits | | 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) |
Ion | \x0f | | - Positive \x2x, negative \x3x
- Zero is always encoded in tag byte.
- BigInts over 13 bytes (104 bits) have 1+ byte overhead for length
| - \x44 (32-bit float)
- \x48 (64-bit float)
- Zero is always encoded in tag byte.
| - UTF-8: \x8x
- Other strings: \x9x
- Arbitrary length and overhead
| \xbx Arbitrary length and overhead. Length in octets. | - Structs (numbered fields): \xdx
- Annotations (named fields): \xex
|
MessagePack | \xc0 | | - Single byte "fixnum" (values −32 – 127)
- or typecode (1 byte) + big-endian (u)int8/16/32/64
| Typecode (1 byte) + IEEE single/double | - Typecode + up to 15 bytes
- or typecode + length as uint8/16/32 + bytes;
encoding is unspecified | - As "fixarray" (single-byte prefix + up to 15 array items)
- or typecode (1 byte) + 2–4 bytes length + array items
| - As "fixmap" (single-byte prefix + up to 15 key-value pairs)
- or typecode (1 byte) + 2–4 bytes length + key-value pairs
|
Netstrings | Not in protocol. | Not in protocol. | Not in protocol. | Not in protocol. | Length-encoded as an ASCII string + ':' + data + ',' Length counts only octets between ':' and ',' | Not in protocol. | Not in protocol. |
OGDL Binary | | | | | | | |
Property list(binary format) | | | | | | | |
Protocol Buffers | | | - 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
| | UTF-8-encoded, preceded by varint-encoded integer length of string in bytes | Repeated value with the same tag or, for varint-encoded integers only, values packed contiguously and prefixed by tag and total byte length | — |
Smile | \x21 | | - Single byte "small" (values −16 – 15 encoded as \xc0–\xdf),
- zigzag-encoded varints (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 | | | | | | | |