Internet Engineering Task Force (IETF) T. Bray, Ed.
Request for Comments: 7493 Textuality Services
Category: Standards Track March 2015
ISSN: 2070-1721
The I-JSON Message Format
Bray Standards Track [Page 1]
RFC 7493 The I-JSON Message Format March 2015
Table of Contents
1. Introduction
RFC 7159 describes the JSON data interchange format, which is widely used in Internet protocols. For historical reasons, that specification allows the use of language idioms and text encoding patterns that are likely to lead to interoperability problems and software breakage, particularly when a program receiving JSON data uses automated software to map it into native programming-language structures or database records. RFC 7159 describes practices that may be used to avoid these interoperability problems.
1.1. Terminology
The terms "object", "member", "array", "number", "name", and "string" in this document are to be interpreted as described in RFC 7159 [RFC7159].
1.2. Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
Bray Standards Track [Page 2]
RFC 7493 The I-JSON Message Format March 2015 2. I-JSON MessagesAn I-JSON message is a JSON text, as defined by RFC 7159.
2.1. Encoding and Characters
I-JSON messages MUST be encoded using UTF-8 [RFC3629].
2.2. Numbers
Software that implements IEEE 754-2008 binary64 (double precision) numbers [IEEE754] is generally available and widely used. Implementations that generate I-JSON messages cannot assume that receiving implementations can process numeric values with greater magnitude or precision than provided by those numbers. I-JSON messages SHOULD NOT include numbers that express greater magnitude or precision than an IEEE 754 double precision number provides, for example, 1E400 or 3.141592653589793238462643383279.
2.3. Object Constraints
Objects in I-JSON messages MUST NOT have members with duplicate names. In this context, "duplicate" means that the names, after processing any escaped characters, are identical sequences of Unicode characters. The order of object members in an I-JSON message does not change the meaning of an I-JSON message. A receiving implementation MAY treat two I-JSON messages as equivalent if they differ only in the order of the object members.
Bray Standards Track [Page 3]
RFC 7493 The I-JSON Message Format March 2015 3. Software BehaviorA major advantage of using I-JSON is that receivers can avoid ambiguous semantics in the JSON messages they receive. This allows receivers to reject or otherwise disregard messages that do not conform to the requirements in this document for I-JSON messages. Protocols that use I-JSON messages can be written so that receiving implementations are required to reject (or, as in the case of security protocols, not trust) messages that do not satisfy the constraints of I-JSON.
4. Recommendations for Protocol Design
I-JSON is designed for use in Internet protocols. The following recommendations apply to the use of I-JSON in such protocols.
4.1. Top-Level Constructs
An I-JSON message can be any JSON value. However, there are software implementations, coded to the older specification [RFC4627], which only accept JSON objects or JSON arrays at the top level of JSON texts. For maximum interoperability with such implementations, protocol designers SHOULD NOT use top-level JSON texts that are neither objects nor arrays.
4.2. Must-Ignore Policy
It is frequently the case that changes to protocols are required after they have been put in production. Protocols that allow the introduction of new protocol elements in a way that does not disrupt the operation of existing software have proven advantageous in practice.
Bray Standards Track [Page 4]
RFC 7493 The I-JSON Message Format March 2015
A good way to support the use of Must-Ignore in I-JSON protocol designs is to require that top-level protocol elements must be JSON objects, and to specify that members whose names are unrecognized MUST be ignored.
4.3. Time and Date Handling
Protocols often contain data items that are designed to contain timestamps or time durations. It is RECOMMENDED that all such data items be expressed as string values in ISO 8601 format, as specified in [RFC3339], with the additional restrictions that uppercase rather than lowercase letters be used, that the timezone be included not defaulted, and that optional trailing seconds be included even when their value is "00". It is also RECOMMENDED that all data items containing time durations conform to the "duration" production in Appendix A of RFC 3339, with the same additional restrictions.
4.4. Binary Data
When it is required that an I-JSON protocol element contain arbitrary binary data, it is RECOMMENDED that this data be encoded in a string value in base64url; see Section 5 of [RFC4648].
5. Security Considerations
All the security considerations that apply to JSON (see RFC 7159) apply to I-JSON. There are no additional security considerations specific to I-JSON.
6. Normative References
[IEEE754] IEEE, "IEEE Standard for Floating-Point Arithmetic", IEEE
Bray Standards Track [Page 5]
RFC 7493 The I-JSON Message Format March 2015
[RFC3339] Klyne, G. and C. Newman, "Date and Time on the Internet: