idnits 2.17.00 (12 Aug 2021) /tmp/idnits47952/draft-crockford-jsonorg-json-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 18. -- Found old boilerplate from RFC 3978, Section 5.5 on line 398. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 375. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 382. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 388. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == The page length should not exceed 58 lines per page, but there was 1 longer page, the longest (page 1) being 407 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- The document has an RFC 3978 Section 5.2(a) Derivative Works Limitation clause. == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 121 has weird spacing: '... false null...' -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- Couldn't find a document date in the document -- date freshness check skipped. Checking references for intended status: Informational ---------------------------------------------------------------------------- == Unused Reference: 'UNICODE' is defined on line 356, but no explicit reference was found in the text ** Obsolete normative reference: RFC 4234 (Obsoleted by RFC 5234) Summary: 4 errors (**), 0 flaws (~~), 4 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 JavaScript Object Notation D. Crockford 2 Internet Draft JSON.org 3 draft-crockford-jsonorg-json-02.txt February, 2006 4 Intended status: Informational 5 Expires: June 10, 2006 7 JavaScript Object Notation 9 Status of this Memo 11 This document may not be modified, and derivative works of it 12 may not be created, except to publish it as an RFC and to 13 translate it into languages other than English. 15 By submitting this Internet-Draft, each author represents that any 16 applicable patent or other IPR claims of which he or she is aware 17 have been or will be disclosed, and any of which he or she becomes 18 aware will be disclosed, in accordance with Section 6 of BCP 79. 20 Internet-Drafts are working documents of the Internet Engineering 21 Task Force (IETF), its areas, and its working groups. Note that 22 other groups may also distribute working documents as 23 Internet-Drafts. 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 The list of current Internet-Drafts can be accessed at 31 http://www.ietf.org/ietf/1id-abstracts.txt. 33 The list of Internet-Draft Shadow Directories can be accessed at 34 http://www.ietf.org/shadow.html. 36 This Internet Draft will expire on June 10, 2006. 38 Copyright Notice 40 Copyright (C) The Internet Society (2006). 42 Abstract 44 JSON (JavaScript Object Notation) is a light-weight, text-based, 45 language-independent, data interchange format. It was derived from 46 the ECMAScript Programming Language Standard. JSON defines a small 47 set of formatting rules for the portable representation of structured 48 data. 50 Conventions used in this document 52 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 53 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 54 document are to be interpreted as described in [RFC-2119]. 56 The grammatical rules in this document are to be interpreted as 57 described in [RFC-4234]. 59 1. Introduction 61 JSON, or JavaScript Object Notation, is a text format for the 62 serialization of structured data. It is derived from the object 63 literals of JavaScript, as defined in the ECMAScript 64 Programming Language Standard [ECMA]. 66 JSON can represent four primitive types (strings, numbers, booleans, 67 and null) and two structured types (objects and arrays). 69 A string is a sequence of zero or more Unicode characters. 71 An object is an unordered collection of zero or more name/value 72 pairs, where a name is a string, and a value is a string, number, 73 boolean, null, object, or array. 75 An array is an ordered sequence of zero or more values. 77 The terms "object" and "array" come from the conventions of 78 JavaScript. 80 JSON's design goals were to be minimal, portable, textual, and a 81 subset of JavaScript. 83 2. JSON Grammar 85 A JSON text is a sequence of tokens. The set of tokens includes six 86 structural characters, strings, numbers, and three literal names. 88 A JSON text is a serialized object or array. 90 JSON-text = object / array 92 These are the six structural characters: 94 begin-array = ws %x5B ws ; [ left square bracket 96 begin-object = ws %x7B ws ; { left curly bracket 98 end-array = ws %x5D ws ; ] right square bracket 100 end-object = ws %x7D ws ; } right curly bracket 102 name-separator = ws %x3A ws ; : colon 104 value-separator = ws %x2C ws ; , comma 106 Insignificant whitespace is allowed before or after any of the six 107 structural characters. 109 ws = *( 110 %x20 / ; Space 111 %x09 / ; Horizontal tab 112 %x0A / ; Line feed or New line 113 %x0D ; Carriage return 114 ) 116 2.1. Values 118 A JSON value MUST be a object, array, number, or string, or one of 119 the three literal names: 121 false null true 123 The literal names MUST be in lower case. No other literal names 124 are allowed. 126 value = false / null / true / object / array / number / string 128 false = %x66.61.6c.73.65 ; false 130 null = %x6e.75.6c.6c ; null 132 true = %x74.72.75.65 ; true 134 2.2. Objects 136 An object structure is represented as a pair of curly brackets 137 surrounding zero or more name/value pairs (or members). A name is 138 a string. A single colon comes after each name, separating the 139 name from the value. A single comma separates a value from a 140 following name. 142 object = begin-object [ member *( value-separator member ) ] 143 end-object 145 member = string name-separator value 147 2.3. Arrays 149 An array structure is represented as square brackets surrounding 150 zero or more values (or elements). Elements are separated by 151 commas. 153 array = begin-array [ value *( value-separator value ) ] 154 end-array 156 2.4. Numbers 158 The representation of numbers is similar to that used in most 159 programming languages. A number contains an integer component 160 which may be prefixed with an optional minus sign, which may be 161 followed by a fraction part and/or an exponent part. 163 Octal and hex forms are not allowed. Leading zeros are not 164 allowed. 166 A fraction part is a decimal point followed by one or more digits. 168 An exponent part begins with the letter E in upper or lower case, 169 which may be followed by a plus or minus sign. The E and optional 170 sign are followed by one or more digits. 172 Numeric values that cannot be represented as sequences of digits 173 (such as Infinity and NaN) are not permitted. 175 number = [ minus ] int [ frac ] [ exp ] 177 decimal-point = %x2E ; . 179 digit1-9 = %x31-39 ; 1-9 181 e = %x65 / %x45 ; e E 183 exp = e [ minus / plus ] 1*DIGIT 185 frac = decimal-point 1*DIGIT 187 int = zero / ( digit1-9 *DIGIT ) 189 minus = %x2D ; - 191 plus = %x2B ; + 193 zero = %x30 ; 0 195 2.5. Strings 197 The representation of strings is similar to conventions used in 198 the C family of programming languages. A string begins and ends 199 with quotation marks. All Unicode characters may be placed within 200 the quotation marks except for the characters which must be 201 escaped: quotation mark, reverse solidus, and the control 202 characters (U+0000 through U+001F). 204 Any character may be escaped. If the character is in the Basic 205 Multilingual Plane (U+0000 through U+FFFF) then it may be 206 represented as a six-character sequence: a reverse solidus 207 followed by the lower case letter u followed by four hexadecimal 208 digits which encode the character's code point. The hexadecimal 209 letters A though F can be in upper or lower case. So, for 210 example, a string containing only a single reverse solidus 211 character may be represented as "\u005C". 213 Alternatively, there are two-character sequence escape 214 representations of some popular characters. So, for example, a 215 string containing only a single reverse solidus character may be 216 represented more compactly as "\\". 218 To escape an extended character that is not in the Basic 219 Multilingual Plane, then the character is represented as a 220 twelve-character sequence, encoding the UTF-16 surrogate pair. 221 So, for example, a string containing only the G clef character 222 (U+1D11E) may be represented as "\uD834\uDD1E". 224 string = quotation-mark *char quotation-mark 226 char = unescaped / 227 escape ( 228 %x22 / ; " quotation mark U+0022 229 %x5C / ; \ reverse solidus U+005C 230 %x2F / ; / solidus U+002F 231 %x62 / ; b backspace U+0008 232 %x66 / ; f form feed U+000C 233 %x6E / ; n line feed U+000A 234 %x72 / ; r carriage return U+000D 235 %x74 / ; t tab U+0009 236 %x75 4HEXDIG ) ; uXXXX U+XXXX 238 escape = %x5C ; \ 240 quotation-mark = %x22 ; " 242 unescaped = %x20-21 / %x23-5B / %x5D-10FFFF 244 3. Encoding 246 JSON text SHOULD be encoded in Unicode. The default encoding is 247 UTF-8. 249 Since the first two characters of a JSON text will always be ASCII 250 characters [RFC-0020], it is possible to determine if an octet stream 251 is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking at the 252 pattern of nulls in the first four octets. 254 00 00 00 xx UTF-32BE 255 00 xx 00 xx UTF-16BE 256 xx 00 00 00 UTF-32LE 257 xx 00 xx 00 UTF-16LE 258 xx xx xx xx UTF-8 260 4. Parsers 262 A JSON parser transforms a JSON text into another representation. A 263 JSON parser MUST accept all texts that conform to the JSON grammar. 264 A JSON parser MAY accept non-JSON forms or extensions. 266 An implementation may set limits on the size of texts that it 267 accepts. An implementation may set limits on the maximum depth of 268 nesting. An implementation may set limits on the range of numbers. 269 An implementation may set limits on the length and character contents 270 of strings. 272 5. Generators 274 A JSON generator produces JSON text. The resulting text MUST 275 strictly conform to the JSON grammar. 277 6. IANA Considerations 279 The MIME media type for JSON text is text/json. See section 7. 281 7. Registration Template 283 To: ietf-types@iana.org 284 Subject: Registration of media type text/json 286 Type name: text 288 Subtype name: json 290 Required parameters: n/a 292 Optional parameters: n/a 294 Encoding considerations: 8bit 296 Security considerations: See section 9 below. 298 Interoperability considerations: n/a 300 Published specification: RFC-XXXX 302 Applications that use this media type: See http://www.JSON.org. 304 Additional information: 306 Magic number(s): n/a 307 File extension(s): .json 308 Macintosh file type code(s): TEXT 310 Person & email address to contact for further information: 311 Douglas Crockford 312 douglas@crockford.com 314 Intended usage: COMMON 316 Restrictions on usage: none 318 Author: Douglas Crockford 320 Change controller: Douglas Crockford 322 8. Security Considerations 324 Generally there are security issues with scripting languages. JSON 325 is a subset of JavaScript, but it is a safe subset that excludes 326 assignment and invocation. 328 A JSON text can be safely passed into JavaScript's eval() function 329 (which compiles and executes a string) if all of the characters not 330 enclosed in strings are in the set of characters which form JSON 331 tokens. This can be quickly determined in JavaScript with two 332 regular expressions and calls to the test and replace methods. 334 var my_JSON_object = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( 335 text.replace(/"(\\.|[^"\\])*"/g, ''))) && 336 eval('(' + text + ')'); 338 9. References 340 9.1 Normative References 342 [ECMA] European Computer Manufacturers Association, "ECMAScript 343 Language Specification 3rd Edition", December 1999, 344 . 347 [RFC-0020] Cerf, V., "ASCII format for Network Interchange", 348 RFC 0020, October 16, 1969. 350 [RFC-2119] Bradner, S., "Key words for use in RFCs to Indicate 351 Requirement Levels", RFC 2119, March 1997. 353 [RFC-4234] Crocker, D., "Augmented BNF for Syntax Specifications: 354 ABNF", RFC 4234, October 2005. 356 [UNICODE] The Unicode Consortium, "The Unicode Standard 357 Version 4.0", 2003, 358 . 360 Author's Address 362 Douglas Crockford 363 JSON.org 364 Contact Email: douglas@crockford.com 366 Intellectual Property Statement 368 The IETF takes no position regarding the validity or scope of any 369 Intellectual Property Rights or other rights that might be claimed to 370 pertain to the implementation or use of the technology described in 371 this document or the extent to which any license under such rights 372 might or might not be available; nor does it represent that it has 373 made any independent effort to identify any such rights. Information 374 on the procedures with respect to rights in RFC documents can be 375 found in BCP 78 and BCP 79. 377 Copies of IPR disclosures made to the IETF Secretariat and any 378 assurances of licenses to be made available, or the result of an 379 attempt made to obtain a general license or permission for the use of 380 such proprietary rights by implementers or users of this 381 specification can be obtained from the IETF on-line IPR repository at 382 http://www.ietf.org/ipr. 384 The IETF invites any interested party to bring to its attention any 385 copyrights, patents or patent applications, or other proprietary 386 rights that may cover technology that may be required to implement 387 this standard. Please address the information to the IETF at ietf- 388 ipr@ietf.org. 390 Disclaimer of Validity 392 This document and the information contained herein are provided on an 393 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 394 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 395 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 396 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 397 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 398 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 400 Copyright Statement 402 Copyright (C) The Internet Society (2006). This document is subject 403 to the rights, licenses and restrictions contained in BCP 78, and 404 except as set forth therein, the authors retain all their rights. 406 This Internet-Draft will expire on June 10, 2006.