idnits 2.17.00 (12 Aug 2021) /tmp/idnits47404/draft-crockford-jsonorg-json-03.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 451. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 428. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 435. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 441. ** 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 460 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 ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '116' on line 359 -- Looks like a reference, but probably isn't: '943' on line 359 -- Looks like a reference, but probably isn't: '234' on line 359 -- Looks like a reference, but probably isn't: '38793' on line 359 ** Obsolete normative reference: RFC 4234 (Obsoleted by RFC 5234) Summary: 4 errors (**), 0 flaws (~~), 3 warnings (==), 11 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 JavaScript Object Notation (JSON) D. Crockford 2 Internet Draft JSON.org 3 draft-crockford-jsonorg-json-03.txt February, 2006 4 Intended status: Informational 5 Expires: June 10, 2006 7 JavaScript Object Notation (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 JavaScript Object Notation (JSON) 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 JavaScript Object Notation (JSON) 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, Third Edition [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 [UNICODE]. 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. 281 Type name: text 283 Subtype name: json 285 Required parameters: n/a 287 Optional parameters: n/a 289 Encoding considerations: 8bit 291 Security considerations: 293 Generally there are security issues with scripting languages. 294 JSON is a subset of JavaScript, but it is a safe subset that 295 excludes assignment and invocation. 297 A JSON text can be safely passed into JavaScript's eval() 298 function (which compiles and executes a string) if all of the 299 characters not enclosed in strings are in the set of characters 300 which form JSON tokens. This can be quickly determined in 301 JavaScript with two regular expressions and calls to the test and 302 replace methods. 304 var my_JSON_object = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( 305 text.replace(/"(\\.|[^"\\])*"/g, ''))) && 306 eval('(' + text + ')'); 308 Interoperability considerations: n/a 310 Published specification: RFC-XXXX 312 Applications that use this media type: 314 JSON has been used to exchange data between applications written 315 in all of these programming languages: ActionScript, C, C#, 316 ColdFusion, Common Lisp, E, Erlang, Java, JavaScript, Lua, 317 Objective CAML, Perl, PHP, Python, Rebol, Ruby, and Scheme. 319 Additional information: 321 Magic number(s): n/a 322 File extension(s): .json 323 Macintosh file type code(s): TEXT 325 Person & email address to contact for further information: 326 Douglas Crockford 327 douglas@crockford.com 329 Intended usage: COMMON 331 Restrictions on usage: none 333 Author: 334 Douglas Crockford 335 douglas@crockford.com 337 Change controller: 338 Douglas Crockford 339 douglas@crockford.com 341 7. Security Considerations 343 See Security considerations in Section 6. 345 8. Examples 347 This is a JSON object: 349 { 350 "Image": { 351 "Width": 800, 352 "Height": 600, 353 "Title": "View from 15th Floor", 354 "Thumbnail": { 355 "Url": "http://scd.mm-b1.yimg.com/image/481989943", 356 "Height": 125, 357 "Width": "100" 358 }, 359 "IDs": [116, 943, 234, 38793] 360 } 361 } 363 Its Image member is an object whose Thumbnail member is an object 364 and whose IDs member is an array of numbers. 366 This is a JSON array containing two objects: 368 [ 369 { 370 "precision": "zip", 371 "Latitude": 37.7668, 372 "Longitude": -122.3959, 373 "Address": "", 374 "City": "SAN FRANCISCO", 375 "State": "CA", 376 "Zip": "94107", 377 "Country": "US" 378 }, 379 { 380 "precision": "zip", 381 "Latitude": 37.371991, 382 "Longitude": -122.026020, 383 "Address": "", 384 "City": "SUNNYVALE", 385 "State": "CA", 386 "Zip": "94085", 387 "Country": "US" 388 } 389 ] 391 9. References 393 9.1 Normative References 395 [ECMA] European Computer Manufacturers Association, "ECMAScript 396 Language Specification 3rd Edition", December 1999, 397 . 400 [RFC-0020] Cerf, V., "ASCII format for Network Interchange", 401 RFC 0020, October 16, 1969. 403 [RFC-2119] Bradner, S., "Key words for use in RFCs to Indicate 404 Requirement Levels", RFC 2119, March 1997. 406 [RFC-4234] Crocker, D., "Augmented BNF for Syntax Specifications: 407 ABNF", RFC 4234, October 2005. 409 [UNICODE] The Unicode Consortium, "The Unicode Standard 410 Version 4.0", 2003, 411 . 413 Author's Address 415 Douglas Crockford 416 JSON.org 417 Contact Email: douglas@crockford.com 419 Intellectual Property Statement 421 The IETF takes no position regarding the validity or scope of any 422 Intellectual Property Rights or other rights that might be claimed to 423 pertain to the implementation or use of the technology described in 424 this document or the extent to which any license under such rights 425 might or might not be available; nor does it represent that it has 426 made any independent effort to identify any such rights. Information 427 on the procedures with respect to rights in RFC documents can be 428 found in BCP 78 and BCP 79. 430 Copies of IPR disclosures made to the IETF Secretariat and any 431 assurances of licenses to be made available, or the result of an 432 attempt made to obtain a general license or permission for the use of 433 such proprietary rights by implementers or users of this 434 specification can be obtained from the IETF on-line IPR repository at 435 http://www.ietf.org/ipr. 437 The IETF invites any interested party to bring to its attention any 438 copyrights, patents or patent applications, or other proprietary 439 rights that may cover technology that may be required to implement 440 this standard. Please address the information to the IETF at ietf- 441 ipr@ietf.org. 443 Disclaimer of Validity 445 This document and the information contained herein are provided on an 446 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 447 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 448 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 449 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 450 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 451 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 453 Copyright Statement 455 Copyright (C) The Internet Society (2006). This document is subject 456 to the rights, licenses and restrictions contained in BCP 78, and 457 except as set forth therein, the authors retain all their rights. 459 This Internet-Draft will expire on June 10, 2006.