idnits 2.17.1 draft-ietf-json-text-sequence-07.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 (September 17, 2014) is 3508 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) -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 3 comments (--). 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 September 17, 2014 5 Expires: March 21, 2015 7 JavaScript Object Notation (JSON) Text Sequences 8 draft-ietf-json-text-sequence-07 10 Abstract 12 This document describes the JSON text sequence format and associated 13 media type, "application/json-seq". 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 March 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. Conventions used in this document . . . . . . . . . . . . . 3 51 2. JSON Text Sequence Format . . . . . . . . . . . . . . . . . 4 52 2.1. JSON text sequence parsing . . . . . . . . . . . . . . . . . 4 53 2.2. JSON text sequence encoding . . . . . . . . . . . . . . . . 4 54 2.3. Top-level numeric values . . . . . . . . . . . . . . . . . . 5 55 2.4. Incomplete JSON texts are not be fatal . . . . . . . . . . . 5 56 2.5. Interoperability note . . . . . . . . . . . . . . . . . . . 5 57 3. Security Considerations . . . . . . . . . . . . . . . . . . 6 58 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . 7 59 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 8 60 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 61 6.1. Normative References . . . . . . . . . . . . . . . . . . . . 9 62 6.2. Informative References . . . . . . . . . . . . . . . . . . . 9 63 Author's Address . . . . . . . . . . . . . . . . . . . . . . 10 65 1. Introduction and Motivation 67 The JavaScript Object Notation (JSON) [RFC7159] is a very handy 68 serialization format. However, when serializing a large sequence of 69 values as an array, or a possibly indeterminate-length or never- 70 ending sequence of values, JSON becomes difficult to work with. 72 Consider a sequence of one million values, each possibly 1 kilobyte 73 when encoded -- roughly one gigabyte. It is often desirable to 74 process such a dataset in an incremental manner: without having to 75 first read all of it before beginning to produce results. 76 Traditionally the way to do this with JSON is to use a "streaming" 77 parser, but these are neither widely available, widely used, nor easy 78 to use. 80 This document describes the concept and format of "JSON text 81 sequences", which are specifically not JSON texts themselves but are 82 composed of (possible) JSON texts. JSON text sequences can be parsed 83 (and produced) incrementally without having to have a streaming 84 parser (nor streaming encoder). 86 1.1. Conventions used in this document 88 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 89 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 90 document are to be interpreted as described in [RFC2119]. 92 2. JSON Text Sequence Format 94 Two ABNF rules are used in the definition of JSON text sequences: one 95 for parsers, and one for encoders. Two rules are provided to permit 96 recovery by parsers from sequences where some the elements are 97 truncated for whatever reason. The rule for parsers is specified in 98 terms of octet strings which are then interpreted as JSON-texts if 99 possible. The rule for encoders, on the other hand, assumes that 100 sequence elements are not truncated. 102 2.1. JSON text sequence parsing 104 The ABNF [RFC5234] for the JSON text sequence parser is as given in 105 Figure 1. 107 JSON-sequence = *(1*RS possible-JSON) 108 RS = %x1E; "record separator" (RS), see ISO 646-1991 109 possible-JSON = 1*(not-RS); attempt to parse as UTF-8-encoded 110 ; JSON-text (see RFC7159) 111 not-RS = %x00-1d / %x1f-ff; any octets other than RS 113 Figure 1: JSON text sequence ABNF 115 In prose: a series of octet strings, each containing any octet other 116 than a record separator (RS) (0x1E) [ISO.646.1991], all octet strings 117 separated from each other by RS octets. Each octet string in the 118 sequence is to be parsed as a JSON-text. 120 If parsing of such an octet string as a JSON-text fails, the parser 121 should nonetheless continue parsing the remainder of the sequence; 122 the parser SHOULD report such failures so that applications may 123 terminate processing if desired. Multiple consecutive RS octets do 124 not denote empty sequence elements between them. Parsers MAY report 125 about empty sequence elements. 127 2.2. JSON text sequence encoding 129 The ABNF for the JSON text sequence encoder is given in Figure 2. 131 JSON-sequence = *(RS JSON-text LF) 132 RS = %x1E; see ISO 646-1991 133 LF = %x0A; "line feed" (LF), see ISO 646-1991 134 JSON-text = 136 Figure 2: JSON text sequence ABNF 138 In prose: any number of JSON texts, each preceded and followed by one 139 or more ASCII RS characters and each followed by a line feed (LF). 141 Since ASCII RS is a control character it may only appear in JSON 142 strings in escaped form (see [RFC7159]), and since RS may not appear 143 in JSON texts in any other form, RS unambiguously delimits the start 144 of any element in the sequence. RS is sufficient to unambiguously 145 delimit all top-level JSON value types other than numbers. Following 146 each JSON-text in the sequence with an LF serves to disambiguate 147 JSON-texts consisting of numbers at the top-level. 149 2.3. Top-level numeric values 151 Parsers MUST check that any JSON-texts that are a top-level number 152 include JSON whitespace ("ws" ABNF rule from [RFC7159]) after the 153 number, otherwise the JSON-text may have been truncated. Parsers 154 MUST drop JSON-text sequence elements that may have been truncated 155 (see previous sentence), but MAY report such texts (including, 156 optionally, the parsed text and/or the original octet string). 158 2.4. Incomplete JSON texts are not be fatal 160 Per- Section 2.1, JSON text sequence parsers SHOULD NOT abort when RS 161 terminates an incomplete JSON text. Such a situation may arise in 162 contexts where append-writes to log files are truncated by the 163 filesystem (e.g., due to a crash, or administrative process 164 termination). 166 2.5. Interoperability note 168 There exist applications which use a format not unlike this one, but 169 using LF instead of RS as the separator, some even using no separator 170 between JSON texts. JSON text sequence parsers MAY parse such 171 sequences, but JSON text sequence encoders MUST adhere to the rules 172 in Section 2.2. 174 3. Security Considerations 176 All the security considerations of JSON [RFC7159] apply. This format 177 provides no cryptographic integrity protection of any kind. 179 There is no end of sequence indicator. This means that "end of 180 file", "end of transmission", and so on, can be indistinguishable 181 from truncation and/or arbitrary additions. Applications where this 182 matters should denote end of sequence by convention (e.g., Content- 183 Length in the Hypertext Transfer Protocol (HTTP) [RFC7230]), and 184 anyways they should use protocols that provide at least integrity 185 protection of application data (e.g., Transport Layer Security (TLS) 186 [RFC5246]). 188 4. IANA Considerations 190 The MIME media type for JSON text sequences is application/json-seq. 192 Type name: application 194 Subtype name: json-seq 196 Required parameters: n/a 198 Optional parameters: n/a 200 Encoding considerations: binary 202 Security considerations: See , 203 Section 3. 205 Interoperability considerations: Described herein. 207 Published specification: . 209 Applications that use this media type: is likely to support this format>. 212 5. Acknowledgements 214 Phillip Hallam-Baker proposed the use of JSON text sequences for 215 logfiles and pointed out the need for resynchronization. James 216 Manger contributed the ABNF for resynchronization. Stephen Dolan 217 created , which uses something like 218 JSON text sequences (with LF as the separator between texts on 219 output, and requiring only such whitespace as needed to disambiguate 220 on input). Carsten Bormann suggested the use of ASCII RS, and Joe 221 Hildebrand suggested the use of LF in addition to RS for 222 disambiguating top-level number values. Paul Hoffman shephered the 223 Internet-Draft. Many others contributed reviews and comments on the 224 JSON Working Group mailing list. 226 6. References 228 6.1. Normative References 230 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 231 Requirement Levels", BCP 14, RFC 2119, March 1997. 233 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 234 Specifications: ABNF", STD 68, RFC 5234, January 2008. 236 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 237 Interchange Format", RFC 7159, March 2014. 239 [ISO.646.1991] 240 International Organization for Standardization, 241 "Information technology - ISO 7-bit coded character set 242 for information interchange", ISO Standard 646, 1991. 244 6.2. Informative References 246 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 247 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 249 [RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol 250 (HTTP/1.1): Message Syntax and Routing", RFC 7230, 251 June 2014. 253 Author's Address 255 Nicolas Williams 256 Cryptonector, LLC 258 Email: nico@cryptonector.com