CBOR Major Types
Every CBOR data item starts with a single byte. The upper 3 bits identify the major type (0-7). The lower 5 bits carry the argument or additional info. RFC 8949 §3.
8
Types
0
Unsigned Integer
0x00CBOR major type 0 encodes unsigned integers.
1
Negative Integer
0x20CBOR major type 1 encodes negative integers.
2
Byte String
0x40CBOR major type 2 encodes byte strings (raw binary data).
3
Text String
0x60CBOR major type 3 encodes UTF-8 text strings.
4
Array
0x80CBOR major type 4 encodes arrays (ordered sequences of data items).
5
Map
0xa0CBOR major type 5 encodes maps (key-value pairs).
6
Tag
0xc0CBOR major type 6 wraps a single data item with a semantic tag number.
7
Floating-Point and Simple Values
0xe0CBOR major type 7 encodes simple values (false=0xf4, true=0xf5, null=0xf6, undefined=0xf7) and IEEE 754 floating-point numbers (half=0xf9, single=0xfa, double=0xfb).