One document matched: draft-ietf-json-i-json-03.xml
<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC3629 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3629.xml">
<!ENTITY RFC7159 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7159.xml">
<!ENTITY RFC3339 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3339.xml">
<!ENTITY RFC4627 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4627.xml">
<!ENTITY RFC4648 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4648.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<rfc category="std" docName="draft-ietf-json-i-json-03" ipr="trust200902">
<!-- ***** FRONT MATTER ***** -->
<front>
<title>The I-JSON Message Format</title>
<author fullname="Tim Bray" initials="T." role="editor"
surname="Bray">
<organization>Textuality Services</organization>
<address>
<email>tbray@textuality.com</email>
<uri>https://www.tbray.org/</uri>
</address>
</author>
<date year="2014" month="August" />
<keyword>JSON</keyword>
<abstract>
<t>I-JSON is a restricted profile of JSON designed to
maximize interoperability and increase confidence that software can
process it successfully with predictable results.</t>
</abstract>
</front>
<middle>
<section title="Introduction">
<t>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 which 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
which may be used to avoid these interoperability problems.</t>
<t>This document specifies I-JSON, short for "Internet JSON".
The unit of definition is the "I-JSON message".
I-JSON messages are also "JSON texts" as defined in RFC 7159
but with certain extra constraints which enforce the good
interoperability practices described in that specification.</t>
<section title="Terminology">
<t>The terms "object", "member", "array", "number", "name", and
"string" in this document are to be interpreted as described in
<xref target="RFC7159">RFC 7159</xref>.</t>
</section>
<section title="Requirements Language">
<t>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 <xref
target="RFC2119">RFC 2119</xref>.</t>
</section>
</section>
<section title="I-JSON Messages">
<t>An I-JSON message is a JSON text, as defined by RFC 7159.</t>
<section title="Encoding and Characters">
<t>I-JSON messages MUST be encoded using UTF-8
<xref target="RFC3629" />.</t>
<t>Object member names, and string values in arrays and object members,
MUST NOT include code points which identify Surrogates or
Noncharacters.</t>
<t>This applies both to characters encoded directly in UTF-8
and to those which are escaped; thus, "\uDEAD" is invalid
because it is an unpaired surrogate, while "\uD800\uDEAD"
would be legal.</t>
</section>
<section title="Numbers">
<t>Software which implements IEEE 754-2008 binary64 (double
precision) numbers <xref target="IEEE754"/> is generally available and
widely used.
Implementations which generate I-JSON messages MUST NOT 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 which express greater magnitude or
precision than an IEEE 754 double precision number provides, for
example 1E400 or 3.141592653589793238462643383279.</t>
<t>In particular, an I-JSON sender MUST NOT expect a receiver to treat
an integer whose absolute value is greater than 9007199254740991 (i.e.,
that is outside the range [-(2**53)+1, (2**53)-1]) as an exact
value.</t>
<t>For applications which require the exact interchange of numbers with
greater magnitude or precision (one example would be 64-bit
integers), it is RECOMMENDED to
encode them in JSON string values. This requires that the receiving
program understand the intended semantic of the value.</t>
</section>
<section title="Object constraints">
<t>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.</t>
<t>Implementations which generate I-JSON messages MUST NOT assume that
the order of object members in those messages is available to software
which receives them.</t>
</section>
</section>
<section anchor="Behavior" title="Software Behavior">
<t>When software reads data which it expects to be an I-JSON message,
but the data violates one of the MUST constraints in the previous section
(for example, contains an object with a duplicate key, or a UTF-8
encoding error), that software MUST NOT trust nor act on the content of
the message.</t>
<t>Designers of protocols which use I-JSON messages SHOULD provide
a way, in this case, for the receiver of the erroneous data to signal
the problem to the sender.</t>
</section>
<section anchor="Recommendation" title="Protocol-design Recommendations">
<t>I-JSON is designed for use in Internet protocols. The following
recommendations apply to the use of I-JSON in such protocols.</t>
<section anchor="TopLevel" title="Top-level Constructs">
<t>An I-JSON message can be any JSON value. However, there are
software implementations, coded to the older
<xref target="RFC4627" /> specification, which only accept JSON
objects or JSON arrays at the top level of JSON texts. For maximum
interoperability with such implementations, it is RECOMMENDED that
protocol designers avoid the use of top-level JSON texts which are
neither objects nor arrays.</t>
</section>
<section anchor="MustIgnore" title="Must-ignore Policy">
<t>It is frequently the case that changes to protocols are required
after they have been put in production. Protocols which allow the
introduction of new protocol elements in a way that does not disrupt
the operation of existing software have proven advantageous in
practice.</t>
<t>Such a policy is often referred to as "Must-Ignore" and is
expressed with language such as "When receiving software encounters a
protocol element which it does not recognize, it MUST NOT change its
behavior as a consequence, and in particular must not fail." The
converse policy, often referred to as "Must-Understand", does not
tolerate the introduction of new protocol elements, and while this has
proven necessary in certain protocol designs, in general it has been
found to be overly restrictive and brittle.</t>
<t>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
NOT produce behavior changes.</t>
</section>
<section anchor="Dates" title="Time and Date Handling">
<t>Protocols often contain data items which are designed to contain
timestamps or time durations. It is RECOMMENDED that all such
data items be expressed as string values in in ISO 8601 format, as
specified in <xref target="RFC3339" />, with the additional
restriction that uppercase rather than lowercase letters be used.
It is also RECOMMENDED that all data items containing time durations
conform to the "duration" production in Appendix A of RFC3339, with
the same additional restriction.</t>
</section>
<section anchor="Binary" title="Binary Data">
<t>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
<xref target="RFC4648" />.</t>
</section>
</section>
<section anchor="Acknowledgements" title="Acknowledgements">
<t>I-JSON is entirely dependent on the design of JSON, largely
due to Douglas Crockford. The specifics were strongly influenced
by the contributors to the design of RFC 7159 on the IETF JSON
Working Group.</t>
</section>
<section anchor="Security" title="Security Considerations">
<t>All the security considerations which apply to JSON (see RFC 7159)
apply to I-JSON. There are no additional security considerations
specific to I-JSON.</t>
</section>
</middle>
<!-- *****BACK MATTER ***** -->
<back>
<references title="Normative References">
<!--?rfc
include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
&RFC2119;
&RFC3629;
&RFC7159;
&RFC3339;
&RFC4627;
&RFC4648;
<reference anchor="IEEE754" target="http://grouper.ieee.org/groups/754/">
<front>
<title abbrev="IEEE 754">IEEE Standard for Floating-Point
Arithmetic</title>
<author>
<organization>IEEE</organization>
<address />
</author>
<date year="2008"/>
</front>
</reference>
</references>
</back>
</rfc>
| PAFTECH AB 2003-2026 | 2026-04-23 19:34:09 |