D-28359
Major Type | Meaning | Content |
---|---|---|
0 | unsigned integer N | - |
1 | negative integer -1-N | - |
2 | byte string | N bytes |
3 | text string | N bytes (UTF-8 text) |
4 | array | N data items (elements) |
5 | map | 2N data items (key/value pairs) |
6 | tag of number N | 1 data item |
7 | simple/float | - |
Major Type | Meaning | Enclosed up to "break" Stop Code |
---|---|---|
0 | (not well-formed) | - |
1 | (not well-formed) | - |
2 | byte string | definite-length byte strings |
3 | text string | definite-length text strings |
4 | array | data items (elements) |
5 | map | data items (key/value pairs) |
6 | (not well-formed) | - |
7 | "break" stop code | - |
5-Bit Value | Semantics |
---|---|
0..23 | Simple value (value 0..23) |
24 | Simple value (value 32..255 in following byte) |
25 | IEEE 754 Half-Precision Float (16 bits follow) |
26 | IEEE 754 Single-Precision Float (32 bits follow) |
27 | IEEE 754 Double-Precision Float (64 bits follow) |
28-30 | Reserved, not well-formed in the present document |
31 | "break" stop code for indefinite-length items ( |
Value | Semantics |
---|---|
0..19 | (unassigned) |
20 | false |
21 | true |
22 | null |
23 | undefined |
24..31 | (reserved) |
32..255 | (unassigned) |
Tag | Data Item | Semantics |
---|---|---|
0 | text string | Standard date/time string; see |
1 | integer or float | Epoch-based date/time; see |
2 | byte string | Unsigned bignum; see |
3 | byte string | Negative bignum; see |
4 | array | Decimal fraction; see |
5 | array | Bigfloat; see |
21 | (any) | Expected conversion to base64url encoding; see |
22 | (any) | Expected conversion to base64 encoding; see |
23 | (any) | Expected conversion to base16 encoding; see |
24 | byte string | Encoded CBOR data item; see |
32 | text string | URI; see |
33 | text string | base64url; see |
34 | text string | base64; see |
36 | text string | MIME message; see |
55799 | (any) | Self-described CBOR; see |
Diagnostic | Encoded |
---|---|
0 | 0x00 |
1 | 0x01 |
10 | 0x0a |
23 | 0x17 |
24 | 0x1818 |
25 | 0x1819 |
100 | 0x1864 |
1000 | 0x1903e8 |
1000000 | 0x1a000f4240 |
1000000000000 | 0x1b000000e8d4a51000 |
18446744073709551615 | 0x1bffffffffffffffff |
18446744073709551616 | 0xc249010000000000000000 |
-18446744073709551616 | 0x3bffffffffffffffff |
-18446744073709551617 | 0xc349010000000000000000 |
-1 | 0x20 |
-10 | 0x29 |
-100 | 0x3863 |
-1000 | 0x3903e7 |
0.0 | 0xf90000 |
-0.0 | 0xf98000 |
1.0 | 0xf93c00 |
1.1 | 0xfb3ff199999999999a |
1.5 | 0xf93e00 |
65504.0 | 0xf97bff |
100000.0 | 0xfa47c35000 |
3.4028234663852886e+38 | 0xfa7f7fffff |
1.0e+300 | 0xfb7e37e43c8800759c |
5.960464477539063e-8 | 0xf90001 |
0.00006103515625 | 0xf90400 |
-4.0 | 0xf9c400 |
-4.1 | 0xfbc010666666666666 |
Infinity | 0xf97c00 |
NaN | 0xf97e00 |
-Infinity | 0xf9fc00 |
Infinity | 0xfa7f800000 |
NaN | 0xfa7fc00000 |
-Infinity | 0xfaff800000 |
Infinity | 0xfb7ff0000000000000 |
NaN | 0xfb7ff8000000000000 |
-Infinity | 0xfbfff0000000000000 |
false | 0xf4 |
true | 0xf5 |
null | 0xf6 |
undefined | 0xf7 |
simple(16) | 0xf0 |
simple(255) | 0xf8ff |
0("2013-03-21T20:04:00Z") | 0xc074323031332d30332d32315432303a 30343a30305a |
1(1363896240) | 0xc11a514b67b0 |
1(1363896240.5) | 0xc1fb41d452d9ec200000 |
23(h'01020304') | 0xd74401020304 |
24(h'6449455446') | 0xd818456449455446 |
32("http://www.example.com") | 0xd82076687474703a2f2f7777772e6578 616d706c652e636f6d |
h'' | 0x40 |
h'01020304' | 0x4401020304 |
"" | 0x60 |
"a" | 0x6161 |
"IETF" | 0x6449455446 |
"\"\\" | 0x62225c |
"\u00fc" | 0x62c3bc |
"\u6c34" | 0x63e6b0b4 |
"\ud800\udd51" | 0x64f0908591 |
[] | 0x80 |
[1, 2, 3] | 0x83010203 |
[1, [2, 3], [4, 5]] | 0x8301820203820405 |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25] | 0x98190102030405060708090a0b0c0d0e 0f101112131415161718181819 |
{} | 0xa0 |
{1: 2, 3: 4} | 0xa201020304 |
{"a": 1, "b": [2, 3]} | 0xa26161016162820203 |
["a", {"b": "c"}] | 0x826161a161626163 |
{"a": "A", "b": "B", "c": "C", "d": "D", "e": "E"} | 0xa5616161416162614261636143616461 4461656145 |
(_ h'0102', h'030405') | 0x5f42010243030405ff |
(_ "strea", "ming") | 0x7f657374726561646d696e67ff |
[_ ] | 0x9fff |
[_ 1, [2, 3], [_ 4, 5]] | 0x9f018202039f0405ffff |
[_ 1, [2, 3], [4, 5]] | 0x9f01820203820405ff |
[1, [2, 3], [_ 4, 5]] | 0x83018202039f0405ff |
[1, [_ 2, 3], [4, 5]] | 0x83019f0203ff820405 |
[_ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25] | 0x9f0102030405060708090a0b0c0d0e0f 101112131415161718181819ff |
{_ "a": 1, "b": [_ 2, 3]} | 0xbf61610161629f0203ffff |
["a", {_ "b": "c"}] | 0x826161bf61626163ff |
{_ "Fun": true, "Amt": -2} | 0xbf6346756ef563416d7421ff |
Byte | Structure/Semantics |
---|---|
0x00..0x17 | unsigned integer 0x00..0x17 (0..23) |
0x18 | unsigned integer (one-byte uint8_t follows) |
0x19 | unsigned integer (two-byte uint16_t follows) |
0x1a | unsigned integer (four-byte uint32_t follows) |
0x1b | unsigned integer (eight-byte uint64_t follows) |
0x20..0x37 | negative integer -1-0x00..-1-0x17 (-1..-24) |
0x38 | negative integer -1-n (one-byte uint8_t for n follows) |
0x39 | negative integer -1-n (two-byte uint16_t for n follows) |
0x3a | negative integer -1-n (four-byte uint32_t for n follows) |
0x3b | negative integer -1-n (eight-byte uint64_t for n follows) |
0x40..0x57 | byte string (0x00..0x17 bytes follow) |
0x58 | byte string (one-byte uint8_t for n, and then n bytes follow) |
0x59 | byte string (two-byte uint16_t for n, and then n bytes follow) |
0x5a | byte string (four-byte uint32_t for n, and then n bytes follow) |
0x5b | byte string (eight-byte uint64_t for n, and then n bytes follow) |
0x5f | byte string, byte strings follow, terminated by "break" |
0x60..0x77 | UTF-8 string (0x00..0x17 bytes follow) |
0x78 | UTF-8 string (one-byte uint8_t for n, and then n bytes follow) |
0x79 | UTF-8 string (two-byte uint16_t for n, and then n bytes follow) |
0x7a | UTF-8 string (four-byte uint32_t for n, and then n bytes follow) |
0x7b | UTF-8 string (eight-byte uint64_t for n, and then n bytes follow) |
0x7f | UTF-8 string, UTF-8 strings follow, terminated by "break" |
0x80..0x97 | array (0x00..0x17 data items follow) |
0x98 | array (one-byte uint8_t for n, and then n data items follow) |
0x99 | array (two-byte uint16_t for n, and then n data items follow) |
0x9a | array (four-byte uint32_t for n, and then n data items follow) |
0x9b | array (eight-byte uint64_t for n, and then n data items follow) |
0x9f | array, data items follow, terminated by "break" |
0xa0..0xb7 | map (0x00..0x17 pairs of data items follow) |
0xb8 | map (one-byte uint8_t for n, and then n pairs of data items follow) |
0xb9 | map (two-byte uint16_t for n, and then n pairs of data items follow) |
0xba | map (four-byte uint32_t for n, and then n pairs of data items follow) |
0xbb | map (eight-byte uint64_t for n, and then n pairs of data items follow) |
0xbf | map, pairs of data items follow, terminated by "break" |
0xc0 | text-based date/time (data item follows; see |
0xc1 | epoch-based date/time (data item follows; see |
0xc2 | unsigned bignum (data item "byte string" follows) |
0xc3 | negative bignum (data item "byte string" follows) |
0xc4 | decimal Fraction (data item "array" follows; see |
0xc5 | bigfloat (data item "array" follows; see |
0xc6..0xd4 | (tag) |
0xd5..0xd7 | expected conversion (data item follows; see |
0xd8..0xdb | (more tags; 1/2/4/8 bytes of tag number and then a data item follow) |
0xe0..0xf3 | (simple value) |
0xf4 | false |
0xf5 | true |
0xf6 | null |
0xf7 | undefined |
0xf8 | (simple value, one byte follows) |
0xf9 | half-precision float (two-byte IEEE 754) |
0xfa | single-precision float (four-byte IEEE 754) |
0xfb | double-precision float (eight-byte IEEE 754) |
0xff | "break" stop code |
Format | [1, [2, 3]] | [_ 1, [2, 3]] |
---|---|---|
RFC 713 | c2 05 81 c2 02 82 83 | |
ASN.1 BER | 30 0b 02 01 01 30 06 02 01 02 02 01 03 | 30 80 02 01 01 30 06 02 01 02 02 01 03 00 00 |
MessagePack | 92 01 92 02 03 | |
BSON | 22 00 00 00 10 30 00 01 00 00 00 04 31 00 13 00 00 00 10 30 00 02 00 00 00 10 31 00 03 00 00 00 00 00 | |
CBOR | 82 01 82 02 03 | 9f 01 82 02 03 ff |