idnits 2.17.00 (12 Aug 2021) /tmp/idnits46700/draft-crockford-jsonorg-json-01.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 352. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 329. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 336. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 342. ** 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 361 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 125 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 310, but no explicit reference was found in the text Summary: 3 errors (**), 0 flaws (~~), 4 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 JSON D. Crockford 2 Internet Draft JSON.org 3 draft-crockford-jsonorg-json-01.txt February, 2006 4 Intended status: Informational 5 Expires: June 10, 2006 7 JSON 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 syntax rules in this document are to be interpreted as 57 described in RFC-2234. 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 = %x5B ; [ left square bracket 96 begin-object = %x7B ; { left curly bracket 98 end-array = %x5D ; ] right square bracket 100 end-object = %x7D ; } right curly bracket 102 name-separator = %x3A ; : colon 104 value-separator = %x2C ; , comma 106 2.1. Whitespace 108 The tokens MAY be separated by any combination of these 109 insignificant whitespace characters: 111 space U+0020 Space 112 HT U+0009 Horizontal tab 113 LF U+000A Line feed or New line 114 CR U+000D Carriage return 116 Insignificant whitespace MUST NOT be placed within a 117 multicharacter token (a literal name, number, or string). 118 A space character in a string is significant. 120 2.2. Values 122 A JSON value MUST be a object, array, number, or string, or one of 123 the three literal names: 125 false null true 127 The literal names MUST be in lower case. No other literal names 128 are allowed. 130 value = false / null / true / object / array / number / string 132 false = %x66.61.6c.73.65 ; false 134 null = %x6e.75.6c.6c ; null 136 true = %x74.72.75.65 ; true 138 2.3. Objects 140 An object structure is represented as a pair of curly brackets 141 surrounding zero or more name/value pairs (or members). A name is 142 a string. A single colon comes after each name, separating the 143 name from the value. A single comma separates a value from a 144 following name. 146 object = begin-object [ member *( value-separator member ) ] 147 end-object 149 member = string name-separator value 151 2.4. Arrays 153 An array structure is represented as square brackets surrounding 154 zero or more values (or elements). Elements are separated by 155 commas. 157 array = begin-array [ value *( value-separator value ) ] 158 end-array 160 2.5. Numbers 162 The representation of numbers is similar to that used in most 163 programming languages. A number contains an integer component 164 which may be prefixed with an optional minus sign, which may be 165 followed by a fraction part and/or an exponent part. 167 Octal and hex forms are not allowed. Leading zeros are not 168 allowed. 170 A fraction part is a decimal point followed by one or more digits. 172 An exponent part begins with the letter E in upper or lower case, 173 which may be followed by a plus or minus sign. The E and optional 174 sign are followed by one or more digits. 176 Numeric values that cannot be represented as sequences of digits 177 (such as Infinity and NaN) are not permitted. 179 number = [ minus ] int [ frac ] [ exp ] 181 decimal-point = %x2E ; . 183 digit1-9 = %x31-39 ; 1-9 185 e = %x65 / %x45 ; e E 187 exp = e [ minus / plus ] 1*DIGIT 189 frac = decimal-point 1*DIGIT 191 int = zero / ( digit1-9 *DIGIT ) 193 minus = %x2D ; - 195 plus = %x2B ; + 197 zero = %x30 ; 0 199 2.6. Strings 201 The representation of strings is similar to conventions used in 202 the C family of programming languages. A string begins and ends 203 with quotation marks. All Unicode characters may be placed within 204 the quotation marks except for the characters which must be 205 escaped: quotation mark, reverse solidus, and the control 206 characters (U+0000 through U+001F). 208 Any character may be escaped. If the character is in the Basic 209 Multilingual Plane (U+0000 through U+FFFF) then it may be 210 represented as a six-character sequence: a reverse solidus 211 followed by the lower case letter u followed by four hexadecimal 212 digits which encode the character's code point. The hexadecimal 213 letters A though F can be in upper or lower case. So, for 214 example, a string containing only a single reverse solidus 215 character may be represented as "\u005C". 217 Alternatively, there are two-character sequence escape 218 representations of some popular characters. So, for example, a 219 string containing only a single reverse solidus character may be 220 represented more compactly as "\\". 222 To escape an extended character that is not in the Basic 223 Multilingual Plane, then the character is represented as a 224 twelve-character sequence, encoding the UTF-16 surrogate pair. 225 So, for example, a string containing only the G clef character 226 (U+1D11E) may be represented as "\uD834\uDD1E". 228 string = quotation-mark *char quotation-mark 230 char = unescaped / 231 escape ( 232 %x22 / ; " quotation mark U+0022 233 %x5C / ; \ reverse solidus U+005C 234 %x2F / ; / solidus U+002F 235 %x62 / ; b backspace U+0008 236 %x66 / ; f form feed U+000C 237 %x6E / ; n line feed U+000A 238 %x72 / ; r carriage return U+000D 239 %x74 / ; t tab U+0009 240 %x75 4HEXDIG ) ; uXXXX U+XXXX 242 escape = %x5C ; \ 244 quotation-mark = %x22 ; " 246 unescaped = %x20-21 / %x23-5B / %x5D-10FFFF 248 3. Encoding 250 JSON text SHOULD be encoded in Unicode. The default encoding is 251 UTF-8. 253 Since the first two characters of a JSON text will always be ASCII 254 characters, it is possible to determine if an octet stream is 255 UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking at the 256 pattern of nulls in the first four octets. 258 00 00 00 xx UTF-32BE 259 00 xx 00 xx UTF-16BE 260 xx 00 00 00 UTF-32LE 261 xx 00 xx 00 UTF-16LE 262 xx xx xx xx UTF-8 264 4. Parsers 266 A JSON parser transforms a JSON text into another representation. A 267 JSON parser MUST accept all texts that conform to the JSON grammar. 268 A JSON parser MAY accept non-JSON forms or extensions. 270 An implementation may set limits on the size of texts that it 271 accepts. An implementation may set limits on the maximum depth of 272 nesting. An implementation may set limits on the range of numbers. 273 An implementation may set limits on the length and character contents 274 of strings. 276 5. Generators 278 A JSON generator produces JSON text. The resulting text MUST 279 strictly conform to the JSON grammar. 281 6. IANA Considerations 283 The MIME media type for JSON text is text/json. 285 7. Security Considerations 287 Generally there are security issues with scripting languages. JSON 288 is a subset of JavaScript, but it is a safe subset that excludes 289 assignment and invocation. 291 A JSON text can be safely passed into JavaScript's eval() function 292 (which compiles and executes a string) if all of the characters not 293 enclosed in strings are in the set of characters which form JSON 294 tokens. This can be quickly determined in JavaScript with two 295 regular expressions and calls to the test and replace methods. 297 var my_JSON_object = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( 298 text.replace(/"(\\.|[^"\\])*"/g, ''))) && 299 eval('(' + text + ')'); 301 8. References 303 8.1 Normative References 305 [ECMA] European Computer Manufacturers Association, "ECMAScript 306 Language Specification 3rd Edition", December 1999, 307 . 310 [UNICODE] The Unicode Consortium, "The Unicode Standard 311 Version 4.0", 2003, 312 . 314 Author's Address 316 Douglas Crockford 317 JSON.org 318 Contact Email: douglas@crockford.com 320 Intellectual Property Statement 322 The IETF takes no position regarding the validity or scope of any 323 Intellectual Property Rights or other rights that might be claimed to 324 pertain to the implementation or use of the technology described in 325 this document or the extent to which any license under such rights 326 might or might not be available; nor does it represent that it has 327 made any independent effort to identify any such rights. Information 328 on the procedures with respect to rights in RFC documents can be 329 found in BCP 78 and BCP 79. 331 Copies of IPR disclosures made to the IETF Secretariat and any 332 assurances of licenses to be made available, or the result of an 333 attempt made to obtain a general license or permission for the use of 334 such proprietary rights by implementers or users of this 335 specification can be obtained from the IETF on-line IPR repository at 336 http://www.ietf.org/ipr. 338 The IETF invites any interested party to bring to its attention any 339 copyrights, patents or patent applications, or other proprietary 340 rights that may cover technology that may be required to implement 341 this standard. Please address the information to the IETF at ietf- 342 ipr@ietf.org. 344 Disclaimer of Validity 346 This document and the information contained herein are provided on an 347 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 348 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 349 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 350 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 351 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 352 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 354 Copyright Statement 356 Copyright (C) The Internet Society (2006). This document is subject 357 to the rights, licenses and restrictions contained in BCP 78, and 358 except as set forth therein, the authors retain all their rights. 360 This Internet-Draft will expire on June 10, 2006.