rfc-7493

The I-JSON Message Format

T. Bray (Editor)
date2015-03 streamIETF areaapp wgjson statusPROPOSED STANDARD pages6 canonicalhttps://www.rfc-editor.org/rfc/rfc7493 doi10.17487/RFC7493 errataview
I-JSON (short for "Internet JSON") is a restricted profile of JSON designed to maximize interoperability and increase confidence that software can process it successfully with predictable results.

Extracted elements (19)

design-rationale §4.2

A good way to support Must-Ignore in I-JSON protocol designs is to require top-level protocol elements to be JSON objects and to specify that unrecognized member names MUST be ignored.

json

design-rationale §2.2

An I-JSON sender cannot expect a receiver to treat an integer whose absolute value exceeds 9007199254740991 (outside [-(2**53)+1, (2**53)-1]) as an exact value, due to the limited precision of JavaScript/IEEE 754 double numbers.

json

design-rationale §1

I-JSON restricts JSON to a profile that avoids language idioms and text encoding patterns that historically caused interoperability problems and software breakage, particularly when JSON is mapped into native programming-language structures or database records.

json

design-rationale §4.2

The Must-Ignore policy (ignoring unrecognized protocol elements rather than treating them as errors) has proven advantageous in practice because it allows protocol evolution without disrupting existing software; the contrasting Must-Understand policy has been found overly restrictive and brittle.

json

interoperability-note §2.1

Paired surrogate escapes such as '\uD800\uDEAD' are legal in I-JSON, but lone surrogates like '\uDEAD' are invalid. Implementations must distinguish paired from unpaired surrogates when validating.

json

interoperability-note §4.1

Some JSON implementations coded to the older RFC 4627 specification only accept JSON objects or arrays at the top level. Protocol designers should avoid top-level scalars to maintain compatibility with these implementations.

json

normative-requirement §3 SHOULD

Designers of protocols using I-JSON SHOULD provide a way for a receiver of erroneous data to signal the problem to the sender.

json

normative-requirement §2.2 RECOMMENDED

For applications requiring exact interchange of numbers with greater magnitude or precision than IEEE 754 double, it is RECOMMENDED to encode them in JSON string values, requiring the receiver to understand the intended semantic.

json

normative-requirement §2.1 MUST

I-JSON messages MUST be encoded using UTF-8 (RFC 3629). This requirement applies to the entire message.

json

normative-requirement §2.2 SHOULD NOT

I-JSON messages SHOULD NOT include numbers that express greater magnitude or precision than an IEEE 754 double precision (binary64) number provides, for example 1E400 or 3.141592653589793238462643383279.

json

normative-requirement §2.1 MUST NOT

Object member names and string values MUST NOT include code points that identify Surrogates or Noncharacters as defined by Unicode. This applies to both directly encoded characters and escaped sequences; e.g., '\uDEAD' is invalid as an unpaired surrogate.

json

normative-requirement §2.3 MUST NOT

Objects in I-JSON messages MUST NOT have members with duplicate names. 'Duplicate' means names are identical sequences of Unicode characters after processing any escaped characters.

json

normative-requirement §4.1 SHOULD NOT

Protocol designers SHOULD NOT use top-level JSON texts that are neither objects nor arrays, to maximize interoperability with implementations coded to the older RFC 4627 specification.

json

normative-requirement §4.3 RECOMMENDED

Timestamp and duration data items in I-JSON protocols are RECOMMENDED to be expressed as string values in ISO 8601 / RFC 3339 format, using uppercase letters, including the timezone, and including optional trailing seconds even when '00'.

json

normative-requirement §4.2 MUST NOT

Under a Must-Ignore policy, when an implementation encounters an unrecognized protocol element, it MUST NOT treat this as an error condition; it should act as if the new element simply did not appear.

json

normative-requirement §4.4 RECOMMENDED

When an I-JSON protocol element must contain arbitrary binary data, it is RECOMMENDED that the data be encoded as a base64url string value per Section 5 of RFC 4648.

json

protocol-element §2

An I-JSON message is any JSON text (as defined by RFC 7159) that additionally satisfies the I-JSON constraints: UTF-8 encoding, no surrogates or noncharacters, numbers within IEEE 754 double range, and no duplicate object member names.

json

protocol-element §2.3

The order of object members in an I-JSON message does not change the meaning of the message. A receiving implementation MAY treat two I-JSON messages as equivalent if they differ only in object member order.

json

security-consideration §5

All security considerations that apply to JSON (RFC 7159) apply equally to I-JSON. There are no additional security considerations specific to I-JSON. Because I-JSON forbids JSON idioms that can lead to unpredictable behavior in receiving software, it may be a more secure basis for Internet protocols.

security, json