idnits 2.17.1 draft-ietf-json-text-sequence-06.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 22, 2014) is 3507 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 22, 2014 5 Expires: February 23, 2015 7 JavaScript Object Notation (JSON) Text Sequences 8 draft-ietf-json-text-sequence-06 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 23, 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. Incomplete JSON texts need not be fatal . . . . . . . . . . . 4 53 2.2. Interoperability note . . . . . . . . . . . . . . . . . . . . 4 54 3. Security Considerations . . . . . . . . . . . . . . . . . . . 5 55 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 56 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7 57 6. Normative References . . . . . . . . . . . . . . . . . . . . 8 58 Author's Address . . . . . . . . . . . . . . . . . . . . . . 9 60 1. Introduction and Motivation 62 The JavaScript Object Notation (JSON) [RFC7159] is a very handy 63 serialization format. However, when serializing a large sequence of 64 values as an array, or a possibly indeterminate-length or never- 65 ending sequence of values, JSON becomes difficult to work with. 67 Consider a sequence of one million values, each possibly 1 kilobyte 68 when encoded -- roughly one gigabyte. It is often desirable to 69 process such a dataset in an incremental manner: without having to 70 first read all of it before beginning to produce results. 71 Traditionally the way to do this with JSON is to use a "streaming" 72 parser, but these are neither widely available, widely used, nor easy 73 to use. 75 This document describes the concept and format of "JSON text 76 sequences", which are specifically not JSON texts themselves but are 77 composed of JSON texts. JSON text sequences can be parsed (and 78 produced) incrementally without having to have a streaming parser 79 (nor encoder). 81 1.1. Conventions used in this document 83 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 84 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 85 document are to be interpreted as described in [RFC2119]. 87 2. JSON Text Sequence Format 89 The ABNF [RFC5234] for the JSON text sequence format is as given in 90 Figure 1. 92 JSON-sequence = *(1*RS JSON-text) 93 RS = %x1E; See RFC20 94 JSON-text = 96 Figure 1: JSON text sequence ABNF 98 In prose: any number of JSON texts, each preceded by one or more 99 ASCII RS characters. Since ASCII RS is a control character it may 100 only appear in JSON strings in escaped form, and since RS may not 101 appear in JSON texts in any other form, RS unambiguously delimits 102 every JSON text (except the final text in the sequence). Two or more 103 RS characters in sequence do not denote "empty" nor missing JSON 104 texts. JSON text sequence encoders MAY emit an RS after emitting a 105 JSON text. 107 [[anchor1: TODO: Add proper reference to ASCII, for RS.]] 109 2.1. Incomplete JSON texts need not be fatal 111 JSON text sequence parsers SHOULD NOT abort when RS terminates an 112 incomplete JSON text. Such a situation may arise in contexts where 113 append-writes to log files are truncated by the filesystem (e.g., due 114 to a crash, or administrative process termination). 116 2.2. Interoperability note 118 There exist applications which use a format not unlike this one, but 119 using LF instead of RS as the separator, or even using no whitespace 120 unless it is necessary for disambiguating JSON texts (numbers, 121 booleans, null). JSON text sequence parsers MAY permit this, but 122 JSON text sequence encoders MUST only use RS as the separator (as 123 described above). 125 In some contexts it is useful to write an LF (%x1A) after writing a 126 JSON text: it makes working with line-oriented text tools easier. 128 3. Security Considerations 130 All the security considerations of JSON [RFC7159] apply. 132 There is no end of sequence indicator. This means that "end of 133 file", "end of transmission", and so on, can be indistinguishable 134 from a logical end of sequence. Applications where this matters 135 should denote end of sequence by convention (e.g., Content-Length in 136 HTTP). 138 4. IANA Considerations 140 The MIME media type for JSON text sequences is application/json-seq. 142 Type name: application 144 Subtype name: json-seq 146 Required parameters: n/a 148 Optional parameters: n/a 150 Encoding considerations: binary 152 Security considerations: See , 153 Section 3. 155 Interoperability considerations: Described herein. 157 Published specification: . 159 Applications that use this media type: JSON text 161 sequences have been used in applications written with the jq 162 programming language. 164 5. Acknowledgements 166 Phillip Hallam-Baker proposed the use of JSON text sequences for 167 logfiles and pointed out the need for resynchronization. James 168 Manger contributed the ABNF for resynchronization. Stephen Dolan 169 created , which uses something like JSON text sequences (with LF 170 as the separator between texts on output, and requiring only such 171 whitespace as needed to disambiguate on input). Special thanks to 172 Carsten Bormann for suggesting the use of ASCII RS. 174 6. Normative References 176 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 177 Requirement Levels", BCP 14, RFC 2119, March 1997. 179 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 180 Specifications: ABNF", STD 68, RFC 5234, January 2008. 182 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 183 Interchange Format", RFC 7159, March 2014. 185 Author's Address 187 Nicolas Williams 188 Cryptonector, LLC 190 Email: nico@cryptonector.com