One document matched: draft-ietf-json-text-sequence-06.xml
<?xml version="1.0" encoding="UTF-8"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc tocindent="no"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc tocindent="no"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 PUBLIC "" "http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc5234 PUBLIC "" "http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml">
<!ENTITY rfc7159 PUBLIC "" "http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7159.xml">
]>
<rfc docName="draft-ietf-json-text-sequence-06" ipr="trust200902" category="std">
<front>
<title abbrev="JSON Text Sequences">JavaScript Object Notation (JSON) Text Sequences</title>
<author initials="N." surname="Williams" fullname="Nicolas Williams">
<organization abbrev="Cryptonector">Cryptonector, LLC</organization>
<address>
<email>nico@cryptonector.com</email>
</address>
</author>
<date month="August" year="2014"/>
<area>
Apps Area
</area>
<workgroup>
json
</workgroup>
<keyword>Internet-Draft</keyword>
<abstract>
<t>
This document describes the JSON text sequence format and associated media type.</t>
</abstract>
</front>
<middle>
<section title="Introduction and Motivation" anchor="d1e201">
<t>
The JavaScript Object Notation (JSON) <xref target="RFC7159"/> is a very handy serialization format. However, when serializing a large sequence of values as an array, or a possibly indeterminate-length or never-ending sequence of values, JSON becomes difficult to work with.</t>
<t>
Consider a sequence of one million values, each possibly 1 kilobyte when encoded -- roughly one gigabyte. It is often desirable to process such a dataset in an incremental manner: without having to first read all of it before beginning to produce results. Traditionally the way to do this with JSON is to use a “streaming” parser, but these are neither widely available, widely used, nor easy to use.</t>
<t>
This document describes the concept and format of “JSON text sequences”, which are specifically not JSON texts themselves but are composed of JSON texts. JSON text sequences can be parsed (and produced) incrementally without having to have a streaming parser (nor encoder).</t>
<section title="Conventions used in this document" anchor="d1e222">
<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"/>.</t>
</section>
</section>
<section title="JSON Text Sequence Format" anchor="sec_JSON_Text_Sequence">
<t>
The ABNF <xref target="RFC5234"/> for the JSON text sequence format is as given in <xref target="fig_JSON_text_sequence"/>.</t>
<t>
</t>
<t>
<figure anchor="fig_JSON_text_sequence" title="JSON text sequence ABNF">
<artwork> JSON-sequence = *(1*RS JSON-text)
RS = %x1E; See RFC20
JSON-text = <given by RFC7159></artwork>
</figure>
</t>
<t>
In prose: any number of JSON texts, each preceded by one or more ASCII RS characters. Since ASCII RS is a control character it may only appear in JSON strings in escaped form, and since RS may not appear in JSON texts in any other form, RS unambiguously delimits every JSON text (except the final text in the sequence). Two or more RS characters in sequence do not denote “empty” nor missing JSON texts. JSON text sequence encoders MAY emit an RS after emitting a JSON text.</t>
<t>
<cref>
TODO: Add proper reference to ASCII, for RS.</cref>
</t>
<section title="Incomplete JSON texts need not be fatal" anchor="d1e288">
<t>
JSON text sequence parsers SHOULD NOT abort when RS terminates an incomplete JSON text. Such a situation may arise in contexts where append-writes to log files are truncated by the filesystem (e.g., due to a crash, or administrative process termination).</t>
</section>
<section title="Interoperability note" anchor="d1e297">
<t>
There exist applications which use a format not unlike this one, but using LF instead of RS as the separator, or even using no whitespace unless it is necessary for disambiguating JSON texts (numbers, booleans, null). JSON text sequence parsers MAY permit this, but JSON text sequence encoders MUST only use RS as the separator (as described above).</t>
<t>
In some contexts it is useful to write an LF (%x1A) after writing a JSON text: it makes working with line-oriented text tools easier.</t>
</section>
</section>
<section title="Security Considerations" anchor="sec_Security_Considerations">
<t>
All the security considerations of JSON <xref target="RFC7159"/> apply.</t>
<t>
There is no end of sequence indicator. This means that “end of file”, “end of transmission”, and so on, can be indistinguishable from a logical end of sequence. Applications where this matters should denote end of sequence by convention (e.g., Content-Length in HTTP).</t>
</section>
<section title="IANA Considerations" anchor="sec_IANA_Considerations">
<t>
The MIME media type for JSON text sequences is application/json-seq.</t>
<t>
Type name: application</t>
<t>
Subtype name: json-seq</t>
<t>
Required parameters: n/a</t>
<t>
Optional parameters: n/a</t>
<t>
Encoding considerations: binary</t>
<t>
Security considerations: See <this document, once published>, <xref target="sec_Security_Considerations"/>.</t>
<t>
Interoperability considerations: Described herein.</t>
<t>
Published specification: <this document, once published>.</t>
<t>
Applicat<eref target="http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>ions that use this media type: JSON text sequences have been used in applications written with the jq programming language.</t>
</section>
<section title="Acknowledgements" anchor="d1e413">
<t>
Phillip Hallam-Baker proposed the use of JSON text sequences for logfiles and pointed out the need for resynchronization. James Manger contributed the ABNF for resynchronization. Stephen Dolan created <eref target="jq"/>, which uses something like JSON text sequences (with LF as the separator between texts on output, and requiring only such whitespace as needed to disambiguate on input). Special thanks to Carsten Bormann for suggesting the use of ASCII RS.</t>
</section>
</middle>
<back>
<references title="Normative References">&rfc2119;
&rfc5234;
&rfc7159;
</references>
</back>
</rfc>
| PAFTECH AB 2003-2026 | 2026-04-24 01:06:22 |