idnits 2.17.1 draft-ietf-json-text-sequence-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (August 20, 2014) is 3536 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259) Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 json N. Williams 3 Internet-Draft Cryptonector 4 Intended status: Standards Track August 20, 2014 5 Expires: February 21, 2015 7 JavaScript Object Notation (JSON) Text Sequences 8 draft-ietf-json-text-sequence-05 10 Abstract 12 This document describes the JSON text sequence format and associated 13 media type. 15 Status of this Memo 17 This Internet-Draft is submitted in full conformance with the 18 provisions of BCP 78 and BCP 79. 20 Internet-Drafts are working documents of the Internet Engineering 21 Task Force (IETF). Note that other groups may also distribute 22 working documents as Internet-Drafts. The list of current Internet- 23 Drafts is at http://datatracker.ietf.org/drafts/current/. 25 Internet-Drafts are draft documents valid for a maximum of six months 26 and may be updated, replaced, or obsoleted by other documents at any 27 time. It is inappropriate to use Internet-Drafts as reference 28 material or to cite them other than as "work in progress." 30 This Internet-Draft will expire on February 21, 2015. 32 Copyright Notice 34 Copyright (c) 2014 IETF Trust and the persons identified as the 35 document authors. All rights reserved. 37 This document is subject to BCP 78 and the IETF Trust's Legal 38 Provisions Relating to IETF Documents 39 (http://trustee.ietf.org/license-info) in effect on the date of 40 publication of this document. Please review these documents 41 carefully, as they describe your rights and restrictions with respect 42 to this document. Code Components extracted from this document must 43 include Simplified BSD License text as described in Section 4.e of 44 the Trust Legal Provisions and are provided without warranty as 45 described in the Simplified BSD License. 47 Table of Contents 49 1. Introduction and Motivation . . . . . . . . . . . . . . . . . 3 50 1.1. JSON Parser Types . . . . . . . . . . . . . . . . . . . . . . 3 51 1.2. Conventions used in this document . . . . . . . . . . . . . . 3 52 2. JSON Text Sequence Format . . . . . . . . . . . . . . . . . . 4 53 2.1. Incomplete JSON texts need not be fatal . . . . . . . . . . . 4 54 2.2. Interoperability note . . . . . . . . . . . . . . . . . . . . 4 55 3. Security Considerations . . . . . . . . . . . . . . . . . . . 5 56 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 57 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7 58 6. Normative References . . . . . . . . . . . . . . . . . . . . 8 59 Author's Address . . . . . . . . . . . . . . . . . . . . . . 9 61 1. Introduction and Motivation 63 The JavaScript Object Notation (JSON) [RFC7159] is a very handy 64 serialization format. However, when serializing a large sequence of 65 values as an array, or a possibly indeterminate-length or never- 66 ending sequence of values, JSON becomes difficult to work with. 68 Consider a sequence of one million values, each possibly 1 kilobyte 69 when encoded -- roughly one gigabyte. It is often desirable to 70 process such a dataset in an incremental manner: without having to 71 first read all of it before beginning to produce results. 72 Traditionally the way to do this with JSON is to use a "streaming" 73 parser (see Section 1.1), but these are neither widely available, 74 widely used, nor easy to use. 76 This document describes the concept and format of "JSON text 77 sequences", which are specifically not JSON texts themselves but are 78 composed of JSON texts. JSON text sequences can be parsed (and 79 produced) incrementally without having to have a streaming parser 80 (nor encoder). 82 1.1. JSON Parser Types 84 For the purposes of this document we shall classify JSON parsers as 85 follows: 87 Streaming Consumes a text incrementally, outputs values 88 incrementally (e.g., as (path, leaf value) pairs). 90 Online Consumes a text incrementally. 92 Off-line Consumes only complete texts. 94 1.2. Conventions used in this document 96 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 97 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 98 document are to be interpreted as described in [RFC2119]. 100 2. JSON Text Sequence Format 102 The ABNF [RFC5234] for the JSON text sequence format is as given in 103 Figure 1. 105 JSON-sequence = *(1*RS JSON-text) 106 RS = 107 JSON-text = 109 Figure 1: JSON text sequence ABNF 111 In prose: any number of JSON texts, each preceded by one or more 112 ASCII RS characters. Since ASCII RS is a control character it may 113 only appear in JSON strings in escaped form, and since RS may not 114 appear in JSON texts in any other form, RS unambiguously delimits 115 every JSON text (except the final text in the sequence, which may be 116 delimited by an external end-of-stream marker). Two or more RS 117 characters in sequence do not denote "empty" nor missing JSON texts. 118 JSON text sequence encoders MAY emit an RS after emitting a JSON 119 text. 121 2.1. Incomplete JSON texts need not be fatal 123 JSON text sequence parsers SHOULD NOT abort when RS terminates an 124 incomplete JSON text. Such a situation may arise in contexts where 125 append-writes to log files are truncated by the filesystem (e.g., due 126 to a crash, or administrative process termination). 128 2.2. Interoperability note 130 There exist applications which use a format not unlike this one, but 131 using LF instead of RS as the separator, or even using no whitespace 132 unless it is necessary for disambiguating JSON texts (numbers, 133 booleans, null). JSON text sequence parsers MAY permit this, but 134 JSON text sequence encoders SHOULD only use RS as the separator (as 135 described above). 137 3. Security Considerations 139 All the security considerations of JSON [RFC7159] apply. 141 There is no end of sequence indicator. This means that "end of 142 file", "end of transmission", and so on, can be indistinguishable 143 from a logical end of sequence. Applications where this matters 144 should denote end of sequence by convention (e.g., Content-Length in 145 HTTP). 147 4. IANA Considerations 149 The MIME media type for JSON text sequences is application/json-seq. 151 Type name: application 153 Subtype name: json-seq 155 Required parameters: n/a 157 Optional parameters: n/a 159 Encoding considerations: binary 161 Security considerations: See , 162 Section 3. 164 Interoperability considerations: Described herein. 166 Published specification: . 168 Applications that use this media type: JSON text 170 sequences have been used in applications written with the jq 171 programming language. 173 5. Acknowledgements 175 Phillip Hallam-Baker proposed the use of JSON text sequences for 176 logfiles and pointed out the need for resynchronization. James 177 Manger contributed the ABNF for resynchronization. Stephen Dolan 178 created , which uses something like JSON text sequences (with LF 179 as the separator between texts on output, and requiring only such 180 whitespace as needed to disambiguate on input). 182 6. Normative References 184 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 185 Requirement Levels", BCP 14, RFC 2119, March 1997. 187 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 188 Specifications: ABNF", STD 68, RFC 5234, January 2008. 190 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 191 Interchange Format", RFC 7159, March 2014. 193 Author's Address 195 Nicolas Williams 196 Cryptonector, LLC 198 Email: nico@cryptonector.com