idnits 2.17.1 draft-kewisch-et-al-icalendar-in-json-02.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 (March 18, 2013) is 4056 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-06) exists of draft-sheffer-running-code-02 -- Obsolete informational reference (is this intentional?): RFC 4627 (Obsoleted by RFC 7158, RFC 7159) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group P. Kewisch 3 Internet-Draft Mozilla 4 Intended status: Standards Track C. Daboo 5 Expires: September 19, 2013 Apple, Inc. 6 M. Douglass 7 RPI 8 March 18, 2013 10 jCal: The JSON format for iCalendar 11 draft-kewisch-et-al-icalendar-in-json-02 13 Abstract 15 This specification defines "jCal", a JSON format for iCalendar data. 17 Status of This Memo 19 This Internet-Draft is submitted in full conformance with the 20 provisions of BCP 78 and BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF). Note that other groups may also distribute 24 working documents as Internet-Drafts. The list of current Internet- 25 Drafts is at http://datatracker.ietf.org/drafts/current/. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 This Internet-Draft will expire on September 19, 2013. 34 Copyright Notice 36 Copyright (c) 2013 IETF Trust and the persons identified as the 37 document authors. All rights reserved. 39 This document is subject to BCP 78 and the IETF Trust's Legal 40 Provisions Relating to IETF Documents 41 (http://trustee.ietf.org/license-info) in effect on the date of 42 publication of this document. Please review these documents 43 carefully, as they describe your rights and restrictions with respect 44 to this document. Code Components extracted from this document must 45 include Simplified BSD License text as described in Section 4.e of 46 the Trust Legal Provisions and are provided without warranty as 47 described in the Simplified BSD License. 49 Table of Contents 51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 52 2. Conventions Used in This Document . . . . . . . . . . . . . . 4 53 3. Converting from iCalendar to jCal . . . . . . . . . . . . . . 5 54 3.1. Pre-processing . . . . . . . . . . . . . . . . . . . . . . 5 55 3.2. iCalendar stream (RFC5545 section 3.4) . . . . . . . . . . 5 56 3.3. Components (RFC5545 section 3.6) . . . . . . . . . . . . . 6 57 3.4. Properties (RFC5545 section 3.7 and 3.8) . . . . . . . . . 7 58 3.4.1. Special Cases for Properties . . . . . . . . . . . . . 8 59 3.4.1.1. Multi-valued Properties (RFC5545 Section 3.1.2) . 8 60 3.4.1.2. GEO Property (RFC5545 Section 3.8.1.6) . . . . . . 8 61 3.4.1.3. REQUEST-STATUS Property (RFC5545 Section 62 3.8.8.3) . . . . . . . . . . . . . . . . . . . . . 9 63 3.5. Parameters (RFC5545 section 3.2) . . . . . . . . . . . . . 9 64 3.5.1. VALUE parameter . . . . . . . . . . . . . . . . . . . 10 65 3.5.2. Multi-value Parameters . . . . . . . . . . . . . . . . 10 66 3.6. Values (RFC5545 section 3.3) . . . . . . . . . . . . . . . 11 67 3.6.1. Binary (RFC5545 section 3.3.1) . . . . . . . . . . . . 11 68 3.6.2. Boolean (RFC5545 section 3.3.2) . . . . . . . . . . . 12 69 3.6.3. Calendar User Address (RFC5545 section 3.3.3) . . . . 12 70 3.6.4. Date (RFC5545 section 3.3.4) . . . . . . . . . . . . . 12 71 3.6.5. Date-Time (RFC5545 section 3.3.5) . . . . . . . . . . 13 72 3.6.6. Duration (RFC5545 section 3.3.6) . . . . . . . . . . . 13 73 3.6.7. Float (RFC5545 section 3.3.7) . . . . . . . . . . . . 13 74 3.6.8. Integer (RFC5545 section 3.3.8) . . . . . . . . . . . 14 75 3.6.9. Period of Time (RFC5545 section 3.3.9) . . . . . . . . 14 76 3.6.10. Recurrence Rule (RFC5545 section 3.3.10) . . . . . . . 14 77 3.6.11. Text (RFC5545 section 3.3.11) . . . . . . . . . . . . 16 78 3.6.12. Time (RFC5545 section 3.3.12) . . . . . . . . . . . . 16 79 3.6.13. URI (RFC5545 section 3.3.13) . . . . . . . . . . . . . 16 80 3.6.14. UTC Offset (RFC5545 section 3.3.14) . . . . . . . . . 16 81 3.7. Extensions . . . . . . . . . . . . . . . . . . . . . . . . 17 82 4. Converting from jCal into iCalendar . . . . . . . . . . . . . 17 83 5. Handling Unrecognized Properties or Parameters . . . . . . . . 17 84 6. Implementation Status (to be removed prior to publication 85 as an RFC) . . . . . . . . . . . . . . . . . . . . . . . . . . 19 86 7. Security Considerations . . . . . . . . . . . . . . . . . . . 20 87 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 88 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 21 89 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 21 90 10.1. Normative References . . . . . . . . . . . . . . . . . . . 21 91 10.2. Informative References . . . . . . . . . . . . . . . . . . 22 92 Appendix A. ABNF Schema . . . . . . . . . . . . . . . . . . . . . 22 93 Appendix B. Examples . . . . . . . . . . . . . . . . . . . . . . 24 94 B.1. Example 1 . . . . . . . . . . . . . . . . . . . . . . . . 24 95 B.1.1. iCalendar Data . . . . . . . . . . . . . . . . . . . . 24 96 B.1.2. jCal Data . . . . . . . . . . . . . . . . . . . . . . 25 98 B.2. Example 2 . . . . . . . . . . . . . . . . . . . . . . . . 25 99 B.2.1. iCalendar Data . . . . . . . . . . . . . . . . . . . . 26 100 B.2.2. jCal Data . . . . . . . . . . . . . . . . . . . . . . 26 101 Appendix C. Change History (to be removed prior to 102 publication as an RFC) . . . . . . . . . . . . . . . 29 104 1. Introduction 106 The iCalendar data format [RFC5545] is a widely deployed interchange 107 format for calendaring and scheduling data. While many applications 108 and services consume and generate calendar data, iCalendar is a 109 specialized format that requires its own parser/generator. In 110 contrast, JSON-based formats as defined in [RFC4627] are the native 111 format for JavaScript widgets and libraries and it is appropriate to 112 have a standard form of calendar data that is easier to work with 113 than iCalendar. 115 The purpose of this specification is to define "jCal", a JSON format 116 for iCalendar data. jCal is defined as a straightforward mapping into 117 JSON from iCalendar, so that iCalendar data can be converted to JSON, 118 and then back to iCalendar, without losing any semantic meaning in 119 the data. Anyone creating jCal calendar data according to this 120 specification will know that their data can be converted to a valid 121 iCalendar representation as well. 123 The key design considerations are essentially the same as those for 124 [RFC6321], that is: 126 Round-tripping (converting an iCalendar instance to jCal and back) 127 will give the same semantic result as the starting point. For 128 example, all components, properties and property parameters are 129 guaranteed to be preserved, with the exception of those which have 130 default values. 132 Ordering of elements will not necessarily be preserved. 134 Preserve the semantics of the iCalendar data. While a simple 135 consumer can easily browse the calendar data in jCal, a full 136 understanding of iCalendar is still required in order to modify 137 and/or fully comprehend the calendar data. 139 Ability to handle many extensions to the underlying iCalendar 140 specification without requiring an update to this document. 142 2. Conventions Used in This Document 144 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 145 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 146 document are to be interpreted as described in [RFC2119]. 148 The underlying format used for jCal is JSON. Consequently, the terms 149 "object" and "array" as well as the four primitive types are to be 150 interpreted as described in Section 1 of [RFC4627]. 152 Some examples in this document contain "partial" JSON documents used 153 for illustrative purposes. In these examples, three periods "..." 154 are used to indicate a portion of the document that has been removed 155 for compactness. 157 3. Converting from iCalendar to jCal 159 This section describes how iCalendar data is converted to jCal using 160 a simple mapping between the iCalendar data model and JSON elements. 162 3.1. Pre-processing 164 iCalendar uses a line folding mechanism to limit lines of data to a 165 maximum line length (typically 72 characters) to ensure maximum 166 likelihood of preserving data integrity as it is transported via 167 various means (e.g., email) - see Section 3.1 of [RFC5545]. Prior to 168 converting iCalendar data into jCal all folded lines MUST be 169 unfolded. 171 iCalendar data uses an "escape" character sequence for text values 172 and property parameter values. When such text elements are converted 173 into jCal the escaping MUST be removed. 175 iCalendar uses a base64 encoding for binary data. However, it does 176 not restrict the encoding from being applied to non-binary value 177 types. So the following rules MUST be applied when processing a 178 property with the "ENCODING" property parameter set to "BASE64": 180 o If the property value type is "BINARY", the base64 encoding MUST 181 be preserved. 183 o If the value type is not "BINARY", the "ENCODING" property 184 parameter MUST be removed, and the value MUST be base64 decoded. 186 When base64 encoding and decoding is used, it MUST conform to Section 187 4 of [RFC4648], which is the base64 method used in [RFC5545]. 189 One key difference in the formatting of values used in iCalendar and 190 jCal is that in jCal the specification uses date/time and utc-offset 191 values aligned with the complete representation, extended format of 192 [ISO.8601.2004]. 194 3.2. iCalendar stream (RFC5545 section 3.4) 196 At the top level of the iCalendar object model is an "iCalendar 197 stream". This stream encompasses multiple "iCalendar objects". In 198 jCal, the entire stream is represented by an array, where the first 199 element is the string "icalendar" and subsequent elements are 200 iCalendar objects represented as described in this document. 202 In the typical case where there is only one iCalendar object, 203 encapsulation inside an "icalendar" array MAY be omitted. 205 An iCalendar stream can contain one or more iCalendar objects. Each 206 iCalendar object, delimited by "BEGIN:VCALENDAR" and "END:VCALENDAR", 207 is represented by a fixed length array with three elements: 209 1. The string "vcalendar" 211 2. An array of jCal properties 213 3. An array of jCal components 215 The representation of an iCalendar object in JSON will be named 216 "vcalendar component" throughout this document. 218 Example: 220 ["icalendar", 221 ["vcalendar", 222 [ /* properties */ ], 223 [ /* components */ ] 224 ], 225 ["vcalendar", 226 [ /* properties */ ], 227 [ /* components */ ] 228 ], 229 ... 230 ] 232 iCalendar objects are comprised of a set of "components", 233 "properties", "parameters" and "values". A "component" can contain 234 other "components" or "properties". A "property" has a "value" and a 235 set of zero or more "parameters". 237 An iCalendar object may contain a mix of iCalendar component types, 238 for example vevent objects delimited by "BEGIN:VEVENT" and "END: 239 VEVENT", task objects delimited by "BEGIN:VTODO" and "END:VTODO". 241 3.3. Components (RFC5545 section 3.6) 243 Each calendar component in the "VCALENDAR" object, delimited by 244 "BEGIN" and "END", will be converted to a fixed length array with 245 three fields that have a specific structure: 247 1. A string with the name of the iCalendar component, but in 248 lowercase. 250 2. An array of jCal properties as described in Section 3.4. 252 3. An array of jCal components, representing the sub-components of 253 the component in question. 255 While the grouping of properties and sub-components does not retain 256 the original order specified in the iCalendar stream, the semantics 257 of a component are preserved. 259 The iCalendar to jCal component mapping is valid for both current 260 iCalendar components and any new iCalendar components added in the 261 future. Conversion is to be done in the same way. 263 Example: 265 ["vevent", 266 [ /* Array of jCal properties */ ], 267 [ /* Array of jCal sub-components */ ] 268 ] 270 3.4. Properties (RFC5545 section 3.7 and 3.8) 272 iCalendar properties, whether they apply to the "VCALENDAR" object or 273 to a component, are handled in a consistent way in the jCal format. 275 Each individual iCalendar property is represented in jCal by an array 276 with three fixed elements, followed by at one or more additional 277 elements, depending on if the property is a multi-value property as 278 described in Section 3.1.2 of [RFC5545]. 280 The array consists of the following fixed elements: 282 1. The name of the property as a string, but in lowercase. 284 2. An object containing the parameters as described in Section 3.5. 286 3. The type identifier string of the value, in lowercase. 288 The remaining elements of the array are used for the value of the 289 property. For single-value properties, the array MUST have exactly 290 four elements, for multi-valued properties as described in 291 Section 3.4.1.1 there can be any number of additional elements. 293 The array describing the property can then be inserted into the array 294 designated for properties in any component, including the "vcalendar" 295 component described in Section 3.3. 297 Example: 299 ["vevent", 300 [ 301 ["summary", {}, "text", "Meeting with Fred"], 302 ["categories", {}, "text", "Meetings", "Work"] 303 ... 304 ], 305 [ /* sub-components */ ] 306 ] 308 The property parameters in the second element of the property array 309 associate a set of parameter names with their respective value. 310 Parameters are further described in Section 3.5. 312 To allow for a cleaner implementation, the parameter object MUST be 313 present even if there are no parameters. In this case, an empty 314 object MUST be used. 316 3.4.1. Special Cases for Properties 318 This section describes some properties that have special handling 319 when converting to jCal. 321 3.4.1.1. Multi-valued Properties (RFC5545 Section 3.1.2) 323 Various iCalendar properties defined in [RFC5545], for example the 324 "CATEGORIES" property, are defined as multi-valued properties. In 325 jCal these properties are added as further members of the array 326 describing the property. 328 Note that additional multi-valued properties may be added in 329 extensions to the iCalendar format. 331 3.4.1.2. GEO Property (RFC5545 Section 3.8.1.6) 333 In iCalendar, the "GEO" property value is defined as a semi-colon 334 separated list of two "FLOAT" values, the first representing latitude 335 and the second longitude. 337 In jCal, the value for the "geo" property is represented like a 338 multi-value property. The first value of the property represents the 339 latitude, the second value represents the longitude. 341 When converting from jCal to iCalendar, the two values MUST be 342 converted using a semi-colon as the separator character. 344 Example 346 ["vevent", 347 [ 348 ["geo", {}, "float", 37.386013, -122.082932 ] 349 ... 350 ], 351 ... 352 ] 354 3.4.1.3. REQUEST-STATUS Property (RFC5545 Section 3.8.8.3) 356 In iCalendar, the "REQUEST-STATUS" property value is defined as a 357 semi-colon separated list of two or three "TEXT" values. The first 358 represents a code, the second a description, and the third any 359 additional data. 361 In jCal, the value for the "request-status" property is represented 362 like a multi-value property. The first value of the property 363 corresponds to the code, the second value corresponds to the 364 description and the third value corresponds to the additional data. 365 Each value is represented using a string value. If there is no 366 additional data in the iCalendar value, the last element of the array 367 SHOULD NOT be present. 369 When converting from jCal to iCalendar, the two or three values MUST 370 be converted using a semi-colon as the separator character. 372 Example: 374 ["vevent": 375 [ 376 ["request-status", {}, "text", "2.0", "Success" ], 377 ["request-status", {}, "text", 378 "3.7", 379 "Invalid Calendar User", 380 "ATTENDEE:mailto:jsmith@example.org" 381 ], 382 ... 383 ], 384 ... 385 ] 387 3.5. Parameters (RFC5545 section 3.2) 389 Property parameters are represented as a JSON object where each key- 390 value pair represents the iCalendar parameter name and its value. 391 The name of the parameter MUST be in lowercase, the original case of 392 the parameter value MUST be preserved. 394 Each individual iCalendar property parameter is represented in jCal 395 by a key-value pair in the parameters object. The key uses the same 396 name as the iCalendar property parameter, but in lowercase. For 397 example, the "PARTSTAT" property parameter is represented in jCal by 398 the "partstat" key. The case of the parameter value MUST be 399 preserved. 401 Example: 403 ["vevent": 404 [ 405 ["attendee", 406 { 407 "partstat": "ACCEPTED", 408 "rsvp": "TRUE", 409 "role": "REQ-PARTICIPANT" 410 }, 411 "cal-address", 412 "mailto:jsmith@example.org" 413 ], 414 ["summary", {}, "text", "Meeting"], 415 ... 416 ], 417 ... 418 ] 420 3.5.1. VALUE parameter 422 iCalendar defines a "VALUE" property parameter (Section 3.2.20 of 423 [RFC5545]). This property parameter MUST NOT be added to the 424 parameters object. Instead, the value type is always explicitly 425 mentioned in the third element of the array describing the property. 426 Thus, when converting from iCalendar to jCal, any "VALUE" property 427 parameters are skipped. When converting from jCal into iCalendar, 428 the appropriate "VALUE" property parameter MUST be included in the 429 iCalendar property if the value type is not the default value type 430 for that property. 432 3.5.2. Multi-value Parameters 434 In [RFC5545], some parameters allow using a COMMA-separated list of 435 values. To ease processing in jCal, the value of a parameter with 436 multiple values MUST be represented in an array containing the 437 separated values. The array elements MUST be string values. Single- 438 value parameters SHOULD be represented using a single string value, 439 but an array with one element MAY also be used. An example for a 440 such parameter is the iCalendar "DELEGATED-FROM" and "DELEGATED-TO" 441 parameter, more such parameters may be added in extensions. 443 DQUOTE characters used to encapsulate the separated values MUST NOT 444 be added to the jCal parameter value. 446 Example 1: 448 ... 449 ["attendee", 450 { 451 "delegated-to": ["mailto:jdoe@example.org", 452 "mailto:jqpublic@example.org"] 453 }, 454 "cal-address", 455 "mailto:jsmith@example.org" 456 ], 457 ... 459 Example 2: 461 ... 462 ["attendee", 463 { 464 "delegated-to": "mailto:jdoe@example.org" 465 }, 466 "cal-address", 467 "mailto:jsmith@example.org" 468 ], 469 ... 471 3.6. Values (RFC5545 section 3.3) 473 The type of an iCalendar value is explicitly mentioned in the third 474 element of the array describing a jCal property. The actual values 475 of the property can be found in the fourth and following elements of 476 the array. 478 3.6.1. Binary (RFC5545 section 3.3.1) 480 Description: iCalendar "BINARY" properties are represented by a 481 property with type identifier "binary". The value is base64 482 encoded data, conforming to Section 4 of [RFC4648], which is the 483 base64 method used in [RFC5545]. 485 Example: 487 ... 488 ["attach", {}, "binary", "SGVsbG8gV29ybGQh"], 489 ... 491 3.6.2. Boolean (RFC5545 section 3.3.2) 493 Description: iCalendar "BOOLEAN" properties are represented by a 494 property with the type identifier "boolean". The value is a 495 boolean JSON value. 497 Example: 499 ... 500 ["x-non-smoking", {}, "boolean", true], 501 ... 503 3.6.3. Calendar User Address (RFC5545 section 3.3.3) 505 Description: iCalendar "CAL-ADDRESS" properties are represented by a 506 property with the type identifier "cal-address". The value is a 507 string with the URI as described in [RFC3986]. 509 Example: 511 ... 512 ["attendee", {}, "cal-address", "mailto:kewisch@example.com"], 513 ... 515 3.6.4. Date (RFC5545 section 3.3.4) 517 Description: iCalendar "DATE" properties are represented by a 518 property with the type identifier "date". The value is the same 519 date value specified by [RFC5545], but formatted using the 520 [ISO.8601.2004] complete representation, extended format. The 521 textual format specifies a four-digit year, two-digit month, and 522 two-digit day of the month, separated by the "-" character. 524 Example: 526 ... 527 ["dtstart", {}, "date", "2011-05-17"], 528 ... 530 3.6.5. Date-Time (RFC5545 section 3.3.5) 532 Description: iCalendar "DATE-TIME" properties are represented by a 533 property with the type identifier "date-time". The value is the 534 same date value specified by [RFC5545], but formatted using the 535 [ISO.8601.2004] complete representation, extended format. The 536 same restrictions with respect to leap seconds and timezone 537 offsets as specified in [RFC5545] Section 3.3.5 apply. 539 Example: 541 ... 542 ["dtstart", {}, "date-time", "2012-10-17T12:00:00"], 543 ["dtstamp", {}, "date-time", "2012-10-17T12:00:00Z"], 544 ["dtend", 545 { "tzid": "Europe/Berlin" }, 546 "date-time", 547 "2011-10-17T13:00:00" 548 ], 549 ... 551 3.6.6. Duration (RFC5545 section 3.3.6) 553 Description: iCalendar "DURATION" properties are represented by a 554 property with the type identifier "duration". The value is the 555 same duration value specified by [RFC5545] as a string. 557 Example: 559 ... 560 ["duration", {}, "duration", "P1D"], 561 ... 563 3.6.7. Float (RFC5545 section 3.3.7) 565 Description: iCalendar "FLOAT" properties are represented by a 566 property with the type identifier "float". The value is the 567 floating point number as a JSON primitive number value. 569 Example: 571 ... 572 ["x-grade", {}, "float", 1.3], 573 ... 575 3.6.8. Integer (RFC5545 section 3.3.8) 577 Description: iCalendar "INTEGER" properties are represented by a 578 property with the type identifier "integer". The value is the 579 floating point number as a JSON primitive number value. 581 Examples: 583 ... 584 ["percent-complete", {}, "integer", 42], 585 ... 587 3.6.9. Period of Time (RFC5545 section 3.3.9) 589 Description: iCalendar "PERIOD" properties are represented by a jCal 590 property with the type identifier "period". The property value is 591 an array, with the first element representing the start of the 592 period and the second element representing the end of the period. 593 As in [RFC5545], the start of the period is always formatted as a 594 date-time value and the end of the period MUST be either a date- 595 time or duration value. Any date, date-time or duration values 596 contained in the period value MUST be formatted in accordance to 597 the rules for date, date-time or duration values specified in this 598 document. 600 Example: 602 ... 603 ["freebusy", 604 { "fbtype": "FREE" }, 605 "period", 606 ["1997-03-08T16:00:00Z", "P1D"] 607 ], 608 ... 610 3.6.10. Recurrence Rule (RFC5545 section 3.3.10) 612 Description: iCalendar "RECUR" properties are represented by a 613 property with the type identifier "recur". The value is an object 614 describing the structured data as specified by [RFC5545]. Each 615 rule part is described by the combination of key and value. The 616 key specifies the name of the rule part and MUST be converted to 617 lowercase. The value of the rule part MUST be mapped by the 618 following rules: 620 * The value of the "freq" and "wskt" rule parts MUST be a string 621 as specified in [RFC5545], with case preserved. 623 * The value of the "until" rule part MUST be a date or date-time 624 value formatted in accordance to the rules for date or date- 625 time specified in this document. 627 * The "count" and "interval" rule parts MUST be specified as a 628 single number value. 630 * The "bysecond", "byminute", "byhour", "bymonthday", 631 "byyearday", "byweekno", "bymonth" and "bysetpos" rule parts 632 MUST each be specified as an array with multiple number values. 633 Single-value rule parts SHOULD be represented using a single 634 string value, but an array with one element MAY also be used. 636 * The "byday" rule part MUST be specified as an array with 637 multiple string values. A single-value "byday" rule part 638 SHOULD be represented using a single string value, but an array 639 with one element MAY also be used. 641 Example 1: 643 ... 644 ["rrule", 645 {}, 646 "recur", 647 { 648 "freq": "YEARLY", 649 "count": 5, 650 "byday": [ "-1SU", "2MO" ], 651 "bymonth": 10 652 } 653 ], 654 ... 656 Example 2: 658 ... 659 ["rrule", 660 {}, 661 "recur", 662 { 663 "freq": "MONTHLY", 664 "interval": 2, 665 "bymonthday": [ 1, 15, -1 ], 666 "until": "2013-10-01" 667 } 668 ], 669 ... 671 3.6.11. Text (RFC5545 section 3.3.11) 673 Description: iCalendar "TEXT" properties are represented by a 674 property with the type identifier "text". The value is the same 675 text value specified by [RFC5545] as a string. 677 Example: 679 ... 680 ["comment", {}, "text", "hello, world"], 681 ... 683 3.6.12. Time (RFC5545 section 3.3.12) 685 Description: iCalendar "TIME" propertes are represented by a 686 property with the type identifier "time". The value is the same 687 date value specified by [RFC5545], but formatted using the 688 [ISO.8601.2004] complete representation, extended format. The 689 same restrictions with respect to leap seconds, time fractions, 690 and timezone offsets as specified in [RFC5545] Section 3.3.12 691 apply. 693 Example: 695 ... 696 ["x-time-local", {}, "time", "12:30:00"], 697 ["x-time-utc", {}, "time", "12:30:00Z"], 698 ["x-time-offset", { "tzid": "Europe/Berlin" }, "time", "12:30:00"], 699 ... 701 3.6.13. URI (RFC5545 section 3.3.13) 703 Description: iCalendar "URI" properties are represented by a 704 property with the type identifier "uri". The value is a string 705 with the URI. 707 Example: 709 ... 710 ["tzurl", {}, "uri", "http://example.org/tz/Europe-Berlin.ics"], 711 ... 713 3.6.14. UTC Offset (RFC5545 section 3.3.14) 714 Description: iCalendar "UTC-OFFSET" properties are represented by a 715 property with the type identifier "utc-offset". The value is a 716 string with the same UTC offset value specified by [RFC5545], with 717 the exception that the hour and minute components are separated by 718 a ":" character, for consistency with the [ISO.8601.2004] timezone 719 offset, extended format. 721 Example: 723 ... 724 ["tzoffsetfrom", {}, "utc-offset", "-05:00"], 725 ["tzoffsetto", {}, "utc-offset", "+12:45"], 726 .. 728 3.7. Extensions 730 iCalendar extension properties and property parameters (those with an 731 "X-" prefix in their name) are handled in the same way as other 732 properties and property parameters: the property is represented by an 733 array, the property parameter represented by an object. The property 734 or parameter name uses the same name as for the iCalendar extension, 735 but in lowercase. For example, the "X-FOO" property in iCalendar 736 turns into the "x-foo" jCal property. See Section 5 for how to deal 737 with default values for unrecognized extension properties or property 738 parameters. 740 4. Converting from jCal into iCalendar 742 When converting component, property and property parameter values, 743 the names SHOULD be converted to uppercase. Although iCalendar names 744 are case insensitive, common practice is to keep them all uppercase 745 following the actual definitions in [RFC5545]. 747 Backslash escaping and line folding MUST be applied to the resulting 748 iCalendar data as required by [RFC5545]. 750 Non-binary value types MUST NOT be base64 encoded. 752 jCal properties that do not specify the default type for the 753 iCalendar property MUST add a VALUE parameter when converting to 754 iCalendar. jCal properties that specify the default type SHOULD NOT 755 add a VALUE parameter. 757 5. Handling Unrecognized Properties or Parameters 759 In iCalendar, properties have a default value type specified by their 760 definition, e.g. "SUMMARY"'s value type is "TEXT" and "DURATION"'s 761 is "DURATION". When a property uses its default value type, the 762 "VALUE" property parameter does not need to be specified on the 763 property. 765 When new properties are defined or "X-" properties used, an iCalendar 766 to jCal converter might not recognize them, and not know what the 767 appropriate default value types are, yet they need to be able to 768 preserve the values. A similar issue arises for unrecognized 769 property parameters. As a result, the following rules are applied 770 when dealing with unrecognized properties and property parameters: 772 o When converting iCalendar into jCal: 774 * Any property that does not include a "VALUE" property parameter 775 and whose default value type is not known, MUST be converted to 776 a string object. The content of that string is the unprocessed 777 value text. 779 * Any unrecognized property parameter MUST be converted to a 780 string value, with its content set to the property parameter 781 value text, treated as if it were a "TEXT" value. 783 o When converting jCal into iCalendar: 785 * Since jCal always explicitly specifies the value type, it can 786 always be converted to iCalendar using the VALUE parameter. 788 * If the value type specified in jCal matches the default value 789 type in iCalendar, the VALUE parameter SHOULD be omitted. 791 Example: The following is an example of an unrecognized iCalendar 792 property (that uses a "DATE-TIME" value as its default), and the 793 equivalent jCal representation of that property. 795 iCalendar: 797 X-PROPERTY:20110512T120000Z 799 jCal: 801 ... 802 ["x-property", {}, "text", "20110512T120000Z"], 803 ... 805 Example: The following is an example of a jCal property (where the 806 corresponding iCalendar property uses a "INTEGER" value as its 807 default), and the equivalent iCalendar representation of that 808 property. 810 jCal: 812 ... 813 ["percent-complete", {}, "integer", 95], 814 ... 816 iCalendar: 818 PERCENT-COMPLETE:95 820 Example: The following is an example of an unrecognized iCalendar 821 property parameter (that uses a "FLOAT" value as its default) 822 specified on a recognized iCalendar property, and the equivalent jCal 823 representation of that property and property parameter. 825 iCalendar: 827 DTSTART;X-PARAM=30.3;VALUE=DATE:20110512 829 jCal: 831 ... 832 ["dtstart", { "x-param": "30.3" }, "date", "2011-05-12"], 833 ... 835 6. Implementation Status (to be removed prior to publication as an RFC) 837 This section describes libraries known to implement this draft as per 838 [I-D.sheffer-running-code]. 840 1. ICAL.js - Philipp Kewisch, James Lal. A JavaScript parser for 841 iCalendar (rfc5545) 843 Source: https://github.com/kewisch/ical.js/ 845 Maturity: production 847 Coverage: All aspects of this draft, up to version 01. Includes 848 an online validator. (as of rev 847c67c501, 2013-02-14) 850 Licensing: MPL, Mozilla Public License 2.0 852 2. Py Calendar - Cyrus Daboo. iCalendar/vCard Library 854 Source: https://svn.calendarserver.org/repository/ 855 calendarserver/PyCalendar/branches/json/ 857 Maturity: production 859 Coverage: All aspects of this draft, up to version 01. 861 Licensing: Apache License, Version 2.0 863 Additionally, interoperability testing of this draft is an ongoing 864 effort under members of calconnect, the Calendaring and Scheduling 865 Consortium. CalDAV Vendors are looking into supporting this draft. 867 7. Security Considerations 869 For security considerations specific to calendar data, see Section 7 870 of [RFC5545]. Since this specification is a mapping from iCalendar, 871 no new security concerns are introduced related to calendar data. 873 The use of JSON as a format does have security risks. Section 7 of 874 [RFC4627] discusses these risks. 876 8. IANA Considerations 878 This document defines a MIME media type for use with iCalendar in 879 JSON data. This media type SHOULD be used for the transfer of 880 calendaring data in JSON. 882 Type name: application 884 Subtype name: calendar+json 886 Required parameters: none 888 Optional parameters: method, component and optinfo as defined for 889 the text/calendar media type in [RFC5545]. 891 Encoding considerations: Same as encoding considerations of 892 application/json as specified in [RFC4627]. 894 Security considerations: See Section 7. 896 Interoperability considerations: This media type provides an 897 alternative format for iCalendar data based on JSON. 899 Published specification: This specification. 901 Applications which use this media type: Applications that currently 902 make use of the text/calendar media type can use this as an 903 alternative. Similarly, Applications that use the application/ 904 json media type to transfer calendaring data can use this to 905 further specify the content. 907 Person & email address to contact for further information: 908 calsify@ietf.org 910 Intended usage: COMMON 912 Restrictions on usage: There are no restrictions on where this media 913 type can be used. 915 Author: See the "Author's Address" section of this document. 917 Change controller: IETF 919 9. Acknowledgments 921 The authors would like to thank the following for their valuable 922 contributions: William Gill, Erwin Rehme, and Dave Thewlis. This 923 specification originated from the work of the XML-JSON technical 924 committee of the Calendaring and Scheduling Consortium. 926 10. References 928 10.1. Normative References 930 [ISO.8601.2004] International Organization for 931 Standardization, ""Data elements and 932 interchange formats -- Information 933 interchange -- Representation of dates 934 and times"", ISO 8601, 12 2004. 936 [RFC2119] Bradner, S., "Key words for use in RFCs 937 to Indicate Requirement Levels", BCP 14, 938 RFC 2119, March 1997. 940 [RFC3986] Berners-Lee, T., Fielding, R., and L. 941 Masinter, "Uniform Resource Identifier 942 (URI): Generic Syntax", STD 66, RFC 3986, 943 January 2005. 945 [RFC4648] Josefsson, S., "The Base16, Base32, and 946 Base64 Data Encodings", RFC 4648, 947 October 2006. 949 [RFC5234] Crocker, D. and P. Overell, "Augmented 950 BNF for Syntax Specifications: ABNF", 951 STD 68, RFC 5234, January 2008. 953 [RFC5545] Desruisseaux, B., "Internet Calendaring 954 and Scheduling Core Object Specification 955 (iCalendar)", RFC 5545, September 2009. 957 [RFC6321] Daboo, C., Douglass, M., and S. Lees, 958 "xCal: The XML Format for iCalendar", 959 RFC 6321, August 2011. 961 10.2. Informative References 963 [I-D.sheffer-running-code] Sheffer, Y. and A. Farrel, "Improving 964 Awareness of Running Code: the 965 Implementation Status Section", 966 draft-sheffer-running-code-02 (work in 967 progress), January 2013. 969 [RFC4627] Crockford, D., "The application/json 970 Media Type for JavaScript Object Notation 971 (JSON)", RFC 4627, July 2006. 973 [calconnect-artifacts] The Calendaring and Scheduling 974 Consortium, "Code Artifacts and Schemas", 975 . 978 Appendix A. ABNF Schema 980 Below is an ABNF schema as per [RFC5234] for iCalendar in JSON. ABNF 981 Symbols not described here are taken from [RFC4627]. The schema is 982 non-normative and given for reference only. 984 The numeric section numbers given in the comments refer to section in 985 [RFC5545]. Additional semantic restrictions apply, especially 986 regarding the allowed properties and sub-components per component. 987 Details on these restrictions can be found in this document and 988 [RFC5545]. 990 Additional schemas may be available on the internet at 991 [calconnect-artifacts]. 993 ; An iCalendar Stream is an array with the first element being the 994 ; string "icalendar". All remaining elements are jcalobjects. 995 jcalstream = begin-array 996 DQUOTE "icalendar" DQUOTE 997 *(value-separator jcalobject) 998 end-array 1000 ; A jCal Object is a component with the component-name "vcalendar". 1002 ; Restrictions to which properties and sub-components may be 1003 ; specified are to be taken from RFC5545. 1004 jcalobject = component 1006 ; A jCal component consists of the name string, properties array and 1007 ; component array 1008 component = begin-array 1009 DQUOTE component-name DQUOTE value-separator 1010 properties-array value-separator 1011 components-array 1012 end-array 1014 components-array = begin-array 1015 [ component *(value-separator component) ] 1016 end-array 1018 ; A jCal property consists of the name string, parameters object, 1019 ; type string and one or more values as specified in this document. 1020 property = begin-array 1021 DQUOTE property-name DQUOTE value-separator 1022 params-object value-separator 1023 DQUOTE type-name DQUOTE 1024 propery-value *(value-separator property-value) 1025 end-array 1026 properties-array = begin-array 1027 [ property *(value-separator property) ] 1028 end-array 1030 ; Property values depend on the type-name. Aside from the value types 1031 ; mentioned here, extensions may make use of other JSON value types. 1032 property-value = string / number / boolean 1034 ; The jCal params-object is a JSON object which follows the semantic 1035 ; guidelines described in this document. 1036 params-object = begin-object 1037 [ params-member *(value-separator params-member) ] 1038 end-object 1039 params-member = DQUOTE param-name DQUOTE name-separator param-value 1040 param-value = string 1042 ; The type MUST be a valid type as described by this document. New 1043 ; value types can be added by extensions. 1044 type-name = "binary" / "boolean" / "cal-address" / "date" / 1045 "date-time" / "duration" / "float" / "integer" / 1046 "period" / "recur" / "text" / "time" / "uri" / 1047 "utc-offset" / x-type 1049 ; Component, property, parameter and type names MUST be lowercase. 1050 ; Additional semantic restrictions apply as described by this 1051 ; document and RFC5545. 1052 component-name = lowercase-name 1053 property-name = lowercase-name 1054 param-name = lowercase-name 1055 x-type = lowercase-name 1056 lowercase-name = 1*(%x61-7A / DIGIT / "-") 1058 Appendix B. Examples 1060 This section contains two examples of iCalendar objects with their 1061 jCal representation. 1063 B.1. Example 1 1065 B.1.1. iCalendar Data 1067 BEGIN:VCALENDAR 1068 CALSCALE:GREGORIAN 1069 PRODID:-//Example Inc.//Example Calendar//EN 1070 VERSION:2.0 1071 BEGIN:VEVENT 1072 DTSTAMP:20080205T191224Z 1073 DTSTART:20081006 1074 SUMMARY:Planning meeting 1075 UID:4088E990AD89CB3DBB484909 1076 END:VEVENT 1077 END:VCALENDAR 1079 B.1.2. jCal Data 1081 ["vcalendar", 1082 [ 1083 ["calscale", {}, "text", "GREGORIAN"], 1084 ["prodid", {}, "text", "-//Example Inc.//Example Calendar//EN"], 1085 ["version", {}, "text", "2.0"] 1086 ], 1087 [ 1088 ["vevent", 1089 [ 1090 ["dtstamp", {}, "date-time", "2008-02-05T19:12:24Z"], 1091 ["dtstart", {}, "date", "2008-10-06"], 1092 ["summary", {}, "text", "Planning meeting"], 1093 ["uid", {}, "text", "4088E990AD89CB3DBB484909"], 1094 ], 1095 [] 1096 ] 1097 ] 1098 ] 1100 B.2. Example 2 1101 B.2.1. iCalendar Data 1103 BEGIN:VCALENDAR 1104 VERSION:2.0 1105 PRODID:-//Example Corp.//Example Client//EN 1106 BEGIN:VTIMEZONE 1107 LAST-MODIFIED:20040110T032845Z 1108 TZID:US/Eastern 1109 BEGIN:DAYLIGHT 1110 DTSTART:20000404T020000 1111 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 1112 TZNAME:EDT 1113 TZOFFSETFROM:-0500 1114 TZOFFSETTO:-0400 1115 END:DAYLIGHT 1116 BEGIN:STANDARD 1117 DTSTART:20001026T020000 1118 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 1119 TZNAME:EST 1120 TZOFFSETFROM:-0400 1121 TZOFFSETTO:-0500 1122 END:STANDARD 1123 END:VTIMEZONE 1124 BEGIN:VEVENT 1125 DTSTAMP:20060206T001121Z 1126 DTSTART;TZID=US/Eastern:20060102T120000 1127 DURATION:PT1H 1128 RRULE:FREQ=DAILY;COUNT=5 1129 RDATE;TZID=US/Eastern;VALUE=PERIOD:20060102T150000/PT2H 1130 SUMMARY:Event #2 1131 DESCRIPTION:We are having a meeting all this week at 12 pm fo 1132 r one hour\, with an additional meeting on the first day 2 h 1133 ours long.\nPlease bring your own lunch for the 12 pm meetin 1134 gs. 1135 UID:00959BC664CA650E933C892C@example.com 1136 END:VEVENT 1137 BEGIN:VEVENT 1138 DTSTAMP:20060206T001121Z 1139 DTSTART;TZID=US/Eastern:20060104T140000 1140 DURATION:PT1H 1141 RECURRENCE-ID;TZID=US/Eastern:20060104T120000 1142 SUMMARY:Event #2 bis 1143 UID:00959BC664CA650E933C892C@example.com 1144 END:VEVENT 1145 END:VCALENDAR 1147 B.2.2. jCal Data 1149 ["vcalendar", 1150 [ 1151 ["prodid", {}, "text", "-//Example Corp.//Example Client//EN"], 1152 ["version", {}, "text", "2.0"], 1153 ], 1154 [ 1155 ["vtimezone", 1156 [ 1157 ["last-modified", {}, "date-time", "2004-01-10T03:28:45Z"], 1158 ["tzid", {}, "text", "US/Eastern"], 1159 ], 1160 [ 1161 ["daylight", 1162 [ 1163 ["dtstart", {}, "date-time", "2000-04-04T02:00:00"], 1164 ["rrule", 1165 {}, 1166 "recur", 1167 "FREQ=YEARLY;BYDAY=1SU;BYMONTH=4" 1168 ], 1169 ["tzname", {}, "text", "EDT"], 1170 ["tzoffsetfrom", {}, "utc-offset", "-05:00"], 1171 ["tzoffsetto", {}, "utc-offset", "-04:00"] 1172 ], 1173 [] 1174 ], 1175 ["standard", 1176 [ 1177 ["dtstart", {}, "date-time", "2000-10-26T02:00:00"], 1178 ["rrule", 1179 {}, 1180 "recur", 1181 "FREQ=YEARLY;BYDAY=1SU;BYMONTH=10" 1182 ], 1183 ["tzname", {}, "text", "EST"], 1184 ["tzoffsetfrom", {}, "utc-offset", "-04:00"], 1185 ["tzoffsetto", {}, "utc-offset", "-05:00"] 1186 ], 1187 [] 1188 ] 1189 ] 1190 ], 1191 ["vevent", 1192 [ 1193 ["dtstamp", {}, "date-time", "2006-02-06T00:11:21Z"], 1194 ["dtstart", 1195 { "tzid": "US/Eastern" }, 1196 "date-time", 1197 "2006-01-02T12:00:00" 1198 ], 1199 ["duration", {}, "duration", "PT1H"], 1200 ["rrule", {}, "recur", "FREQ=DAILY;COUNT=5"], 1201 ["rdate", 1202 { "tzid": "US/Eastern" }, 1203 "period", 1204 "2006-01-02T15:00:00/PT2H" 1205 ], 1206 ["summary", {}, "text", "Event #2"], 1207 ["description", 1208 {}, 1209 "text", 1210 // Note that comments and string concatenation are not 1211 // allowed per JSON specification and is used here only 1212 // to avoid long lines. 1213 "We are having a meeting all this week at 12 pm for one " + 1214 "hour, with an additional meeting on the first day 2 " + 1215 "hours long.\nPlease bring your own lunch for the 12 pm " + 1216 "meetings." 1217 ], 1218 ["uid", {}, "text", "00959BC664CA650E933C892C@example.com"] 1219 ], 1220 [] 1221 ], 1222 ["vevent", 1223 [ 1224 ["dtstamp", {}, "date-time", "2006-02-06T00:11:21Z"], 1225 ["dtstart", 1226 { "tzid": "US/Eastern" }, 1227 "date-time", 1228 "2006-01-02T14:00:00" 1229 ], 1230 ["duration", {}, "duration", "PT1H"], 1231 ["recurrence-id", 1232 { "tzid": "US/Eastern" }, 1233 "date-time", 1234 "2006-01-04T12:00:00" 1235 ], 1236 ["summary", {}, "text", "Event #2"], 1237 ["uid", {}, "text", "00959BC664CA650E933C892C@example.com"] 1238 ], 1239 [] 1240 ] 1241 ] 1242 ] 1244 Appendix C. Change History (to be removed prior to publication as an 1245 RFC) 1247 draft-kewisch-et-al-icalendar-in-json-01 1249 * Added information on how to handle multi-value parameter. The 1250 decision leads to a cleaner draft for a similar proposal for 1251 vcard. 1253 * Removed the open discussion point section regarding the mime 1254 media type in favor of adding one. 1256 * Minor corrections in wording and typo fixes. 1258 draft-kewisch-et-al-icalendar-in-json-02 1260 * Added implementation status section. 1262 * Removed various text tables that just show a conversion from 1263 uppercase to lowercase. 1265 * Changed value format for RECUR and PERIOD types 1267 * Minor corrections in wording and typo fixes. 1269 Authors' Addresses 1271 Philipp Kewisch 1272 Mozilla Corporation 1273 650 Castro Street, Suite 300 1274 Mountain View, CA 94041 1275 USA 1277 EMail: mozilla@kewis.ch 1278 URI: http://www.mozilla.org/ 1280 Cyrus Daboo 1281 Apple Inc. 1282 1 Infinite Loop 1283 Cupertino, CA 95014 1284 USA 1286 EMail: cyrus@daboo.name 1287 URI: http://www.apple.com/ 1288 Mike Douglass 1289 Rensselaer Polytechnic Institute 1290 110 8th Street 1291 Troy, NY 12180 1292 USA 1294 EMail: douglm@rpi.edu 1295 URI: http://www.rpi.edu/