< draft-hallambaker-jsonbcd-13.txt   draft-hallambaker-jsonbcd-14.txt >
Network Working Group P. Hallam-Baker Network Working Group P. Hallam-Baker
Internet-Draft Comodo Group Inc. Internet-Draft April 4, 2019
Intended status: Informational July 13, 2018 Intended status: Informational
Expires: January 14, 2019 Expires: October 6, 2019
Binary Encodings for JavaScript Object Notation: JSON-B, JSON-C, JSON-D Binary Encodings for JavaScript Object Notation: JSON-B, JSON-C, JSON-D
draft-hallambaker-jsonbcd-13 draft-hallambaker-jsonbcd-14
Abstract Abstract
Three binary encodings for JavaScript Object Notation (JSON) are Three binary encodings for JavaScript Object Notation (JSON) are
presented. JSON-B (Binary) is a strict superset of the JSON encoding presented. JSON-B (Binary) is a strict superset of the JSON encoding
that permits efficient binary encoding of intrinsic JavaScript data that permits efficient binary encoding of intrinsic JavaScript data
types. JSON-C (Compact) is a strict superset of JSON-B that supports types. JSON-C (Compact) is a strict superset of JSON-B that supports
compact representation of repeated data strings with short numeric compact representation of repeated data strings with short numeric
codes. JSON-D (Data) supports additional binary data types for codes. JSON-D (Data) supports additional binary data types for
integer and floating-point representations for use in scientific integer and floating-point representations for use in scientific
skipping to change at page 1, line 41 skipping to change at page 1, line 41
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 14, 2019. This Internet-Draft will expire on October 6, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
skipping to change at page 6, line 26 skipping to change at page 6, line 26
array = *cdef begin-array [ *( value value-separator | x-value ) array = *cdef begin-array [ *( value value-separator | x-value )
(value | x-value) ] end-array (value | x-value) ] end-array
x-value = b-value / d-value x-value = b-value / d-value
value = false / null / true / object / array / number / string value = false / null / true / object / array / number / string
name-separator = ws %x3A ws ; : colon name-separator = ws %x3A ws ; : colon
value-separator = ws %x2C ws ; , comma value-separator = ws %x2C ws ; , comma
Figure 1
The following lexical values are unchanged: The following lexical values are unchanged:
begin-array = ws %x5B ws ; [ left square bracket begin-array = ws %x5B ws ; [ left square bracket
begin-object = ws %x7B ws ; { left curly bracket begin-object = ws %x7B ws ; { left curly bracket
end-array = ws %x5D ws ; ] right square bracket end-array = ws %x5D ws ; ] right square bracket
end-object = ws %x7D ws ; } right curly bracket end-object = ws %x7D ws ; } right curly bracket
ws = *( %x20 %x09 %x0A %x0D ) ws = *( %x20 %x09 %x0A %x0D )
false = %x66.61.6c.73.65 ; false false = %x66.61.6c.73.65 ; false
null = %x6e.75.6c.6c ; null null = %x6e.75.6c.6c ; null
true = %x74.72.75.65 ; true true = %x74.72.75.65 ; true
Figure 2
The productions number and string are defined as before: The productions number and string are defined as before:
number = [ minus ] int [ frac ] [ exp ] number = [ minus ] int [ frac ] [ exp ]
decimal-point = %x2E ; . decimal-point = %x2E ; .
digit1-9 = %x31-39 ; 1-9 digit1-9 = %x31-39 ; 1-9
e = %x65 / %x45 ; e E e = %x65 / %x45 ; e E
exp = e [ minus / plus ] 1*DIGIT exp = e [ minus / plus ] 1*DIGIT
frac = decimal-point 1*DIGIT frac = decimal-point 1*DIGIT
int = zero / ( digit1-9 *DIGIT ) int = zero / ( digit1-9 *DIGIT )
minus = %x2D ; - minus = %x2D ; -
skipping to change at page 7, line 25 skipping to change at page 7, line 25
string = quotation-mark *char quotation-mark string = quotation-mark *char quotation-mark
char = unescaped / char = unescaped /
escape ( %x22 / %x5C / %x2F / %x62 / %x66 / escape ( %x22 / %x5C / %x2F / %x62 / %x66 /
%x6E / %x72 / %x74 / %x75 4HEXDIG ) %x6E / %x72 / %x74 / %x75 4HEXDIG )
escape = %x5C ; \ escape = %x5C ; \
quotation-mark = %x22 ; " quotation-mark = %x22 ; "
unescaped = %x20-21 / %x23-5B / %x5D-10FFFF unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
Figure 3
4. JSON-B 4. JSON-B
The JSON-B encoding defines the b-value and b-string productions: The JSON-B encoding defines the b-value and b-string productions:
b-value = b-atom | b-string | b-data | b-integer | b-value = b-atom | b-string | b-data | b-integer |
b-float b-float
b-string = *( string-chunk ) string-term b-string = *( string-chunk ) string-term
b-data = *( data-chunk ) data-last b-data = *( data-chunk ) data-last
b-integer = p-int8 | p-int16 | p-int32 | p-int64 | p-bignum16 | b-integer = p-int8 | p-int16 | p-int32 | p-int64 | p-bignum16 |
n-int8 | n-int16 | n-int32 | n-int64 | n-bignum16 n-int8 | n-int16 | n-int32 | n-int64 | n-bignum16
b-float = binary64 b-float = binary64
Figure 4
The lexical encodings of the productions are defined in the following The lexical encodings of the productions are defined in the following
tables where the column 'tag' specifies the byte code that begins the tables where the column 'tag' specifies the byte code that begins the
production, 'Fixed' specifies the number of data bytes that follow production, 'Fixed' specifies the number of data bytes that follow
and 'Length' specifies the number of bytes used to define the length and 'Length' specifies the number of bytes used to define the length
of a variable length field following the data bytes: of a variable length field following the data bytes:
+--------------+-----+-------+--------+-----------------------------+ +--------------+-----+-------+--------+-----------------------------+
| Production | Tag | Fixed | Length | Data Description | | Production | Tag | Fixed | Length | Data Description |
+--------------+-----+-------+--------+-----------------------------+ +--------------+-----+-------+--------+-----------------------------+
| string-term | x80 | - | 1 | Terminal String 8 bit | | string-term | x80 | - | 1 | Terminal String 8 bit |
skipping to change at page 10, line 24 skipping to change at page 10, line 24
92 3f f0 00 00 00 00 00 00 1.0 92 3f f0 00 00 00 00 00 00 1.0
92 40 24 00 00 00 00 00 00 10.0 92 40 24 00 00 00 00 00 00 10.0
92 40 09 21 fb 54 44 2e ea 3.14159265359 92 40 09 21 fb 54 44 2e ea 3.14159265359
92 bf f0 00 00 00 00 00 00 -1.0 92 bf f0 00 00 00 00 00 00 -1.0
B0 true B0 true
B1 false B1 false
B2 null B2 null
Figure 5
5. JSON-C 5. JSON-C
JSON-C (Compressed) permits numeric code values to be substituted for JSON-C (Compressed) permits numeric code values to be substituted for
strings and binary data. Tag codes MAY be 8, 16 or 32 bits long strings and binary data. Tag codes MAY be 8, 16 or 32 bits long
encoded in network byte order. encoded in network byte order.
Tag codes MUST be defined before they are referenced. A Tag code MAY Tag codes MUST be defined before they are referenced. A Tag code MAY
be defined before the corresponding data or string value is used or be defined before the corresponding data or string value is used or
at the same time that it is used. at the same time that it is used.
skipping to change at page 11, line 50 skipping to change at page 12, line 5
C4 21 80 05 48 65 6c 6c 6f 21 = "Hello" C4 21 80 05 48 65 6c 6c 6f 21 = "Hello"
C0 20 "Hello" C0 20 "Hello"
C1 00 20 "Hello" C1 00 20 "Hello"
D0 00 00 01 00 20 Insert dictionary at code 256 D0 00 00 01 00 20 Insert dictionary at code 256
e3 b0 c4 42 98 fc 1c 14 e3 b0 c4 42 98 fc 1c 14
9a fb f4 c8 99 6f b9 24 9a fb f4 c8 99 6f b9 24
27 ae 41 e4 64 9b 93 4c 27 ae 41 e4 64 9b 93 4c
a4 95 99 1b 78 52 b8 55 UDF (C4 21 80 05 48 65 6c 6c 6f) a4 95 99 1b 78 52 b8 55 UDF (C4 21 80 05 48 65 6c 6c 6f)
Figure 6
6. JSON-D (Data) 6. JSON-D (Data)
JSON-B and JSON-C only support the two numeric types defined in the JSON-B and JSON-C only support the two numeric types defined in the
JavaScript data model: Integers and 64 bit floating point values. JavaScript data model: Integers and 64 bit floating point values.
JSON-D (Data) defines binary encodings for additional data types that JSON-D (Data) defines binary encodings for additional data types that
are commonly used in scientific applications. These comprise are commonly used in scientific applications. These comprise
positive and negative 128 bit integers, six additional floating point positive and negative 128 bit integers, six additional floating point
representations defined by IEEE 754 [IEEE754] and the Intel extended representations defined by IEEE 754 [IEEE754] and the Intel extended
precision 80 bit floating point representation [INTEL] . precision 80 bit floating point representation [INTEL] .
Should the need arise, even bigger bignums could be defined with the Should the need arise, even bigger bignums could be defined with the
length specified as a 32 bit value permitting bignums of up to 2^35 length specified as a 32 bit value permitting bignums of up to 2^35
bits to be represented. bits to be represented.
d-value = d-integer | d-float d-value = d-integer | d-float
d-float = binary16 | binary32 | binary128 | binary80 | d-float = binary16 | binary32 | binary128 | binary80 |
decimal32 | decimal64 | decimal 128 decimal32 | decimal64 | decimal 128
Figure 7
The codes for these values are as follows: The codes for these values are as follows:
+------------+-----+-------+--------+-------------------------------+ +------------+-----+-------+--------+-------------------------------+
| Production | Tag | Fixed | Length | Data Description | | Production | Tag | Fixed | Length | Data Description |
+------------+-----+-------+--------+-------------------------------+ +------------+-----+-------+--------+-------------------------------+
| p-int128 | xA4 | 16 | - | Positive 128 bit Integer | | p-int128 | xA4 | 16 | - | Positive 128 bit Integer |
| n-int128 | xAC | 16 | - | Negative 128 bit Integer | | n-int128 | xAC | 16 | - | Negative 128 bit Integer |
| binary16 | x90 | 2 | - | IEEE 754 Floating Point | | binary16 | x90 | 2 | - | IEEE 754 Floating Point |
| | | | | Binary 16 bit | | | | | | Binary 16 bit |
| binary32 | x91 | 4 | - | IEEE 754 Floating Point | | binary32 | x91 | 4 | - | IEEE 754 Floating Point |
skipping to change at page 15, line 15 skipping to change at page 15, line 15
10. IANA Considerations 10. IANA Considerations
[TBS list out all the code points that require an IANA registration] [TBS list out all the code points that require an IANA registration]
11. References 11. References
11.1. Normative References 11.1. Normative References
[draft-hallambaker-udf] [draft-hallambaker-udf]
Hallam-Baker, P., "Uniform Data Fingerprint (UDF)", draft- Hallam-Baker, P., "Uniform Data Fingerprint (UDF)", draft-
hallambaker-udf-10 (work in progress), April 2018. hallambaker-udf-12 (work in progress), January 2019.
[IEEE754] IEEE Computer Society, "IEEE Standard for Floating-Point [IEEE754] IEEE Computer Society, "IEEE Standard for Floating-Point
Arithmetic", IEEE 754-2008, Arithmetic", IEEE 754-2008,
DOI 10.1109/IEEESTD.2008.4610935, August 2008. DOI 10.1109/IEEESTD.2008.4610935, August 2008.
[INTEL] Intel Corp., "Unknown". [INTEL] Intel Corp., "Unknown".
[RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data
Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
2014. 2014.
11.2. Informative References 11.2. Informative References
[draft-hallambaker-mesh-architecture] [draft-hallambaker-mesh-architecture]
Hallam-Baker, P., "Mathematical Mesh: Architecture", Hallam-Baker, P., "Mathematical Mesh Part I: Architecture
draft-hallambaker-mesh-architecture-04 (work in progress), Guide", draft-hallambaker-mesh-architecture-06 (work in
September 2017. progress), August 2018.
11.3. URIs 11.3. URIs
[1] http://mathmesh.com/Documents/draft-hallambaker-jsonbcd.html [1] http://mathmesh.com/Documents/draft-hallambaker-jsonbcd.html
[2] http://mathmesh.com/Documents/draft-hallambaker-jsonbcd.html [2] http://mathmesh.com/Documents/draft-hallambaker-jsonbcd.html
[3] http://mathmesh.com/Documents/draft-hallambaker-jsonbcd.html [3] http://mathmesh.com/Documents/draft-hallambaker-jsonbcd.html
Author's Address Author's Address
Phillip Hallam-Baker Phillip Hallam-Baker
Comodo Group Inc.
Email: philliph@comodo.com Email: phill@hallambaker.com
 End of changes. 15 change blocks. 
25 lines changed or deleted 10 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/