idnits 2.17.1 draft-ietf-jcardcal-jcard-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 seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. -- The document date (April 30, 2013) is 4012 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) == Missing Reference: 'RFCTODO' is mentioned on line 827, but not defined == Outdated reference: A later version (-10) exists of draft-ietf-jcardcal-jcal-00 == 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 (~~), 5 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 JSON data formats for vCard and iCalendar P. Kewisch 3 Internet-Draft Mozilla 4 Intended status: Standards Track April 30, 2013 5 Expires: November 01, 2013 7 jCard: The JSON format for vCard 8 draft-ietf-jcardcal-jcard-02 10 Abstract 12 This specification defines "jCard", a JSON format for vCard data. 14 Status of This Memo 16 This Internet-Draft is submitted in full conformance with the 17 provisions of BCP 78 and BCP 79. 19 Internet-Drafts are working documents of the Internet Engineering 20 Task Force (IETF). Note that other groups may also distribute 21 working documents as Internet-Drafts. The list of current Internet- 22 Drafts is at http://datatracker.ietf.org/drafts/current/. 24 Internet-Drafts are draft documents valid for a maximum of six months 25 and may be updated, replaced, or obsoleted by other documents at any 26 time. It is inappropriate to use Internet-Drafts as reference 27 material or to cite them other than as "work in progress." 29 This Internet-Draft will expire on November 01, 2013. 31 Copyright Notice 33 Copyright (c) 2013 IETF Trust and the persons identified as the 34 document authors. All rights reserved. 36 This document is subject to BCP 78 and the IETF Trust's Legal 37 Provisions Relating to IETF Documents 38 (http://trustee.ietf.org/license-info) in effect on the date of 39 publication of this document. Please review these documents 40 carefully, as they describe your rights and restrictions with respect 41 to this document. Code Components extracted from this document must 42 include Simplified BSD License text as described in Section 4.e of 43 the Trust Legal Provisions and are provided without warranty as 44 described in the Simplified BSD License. 46 Table of Contents 48 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 49 2. Conventions Used in This Document . . . . . . . . . . . . . . 3 50 3. Converting from vCard to jCard . . . . . . . . . . . . . . . 4 51 3.1. Pre-processing . . . . . . . . . . . . . . . . . . . . . 4 52 3.2. vCard Stream . . . . . . . . . . . . . . . . . . . . . . 4 53 3.3. Properties (RFC6350 section 6) . . . . . . . . . . . . . 5 54 3.3.1. Special Cases for Properties . . . . . . . . . . . . 6 55 3.3.1.1. Multi-valued Properties . . . . . . . . . . . . . 6 56 3.3.1.2. Grouping of Properties . . . . . . . . . . . . . 7 57 3.3.1.3. Structured Property Values . . . . . . . . . . . 8 58 3.4. Parameters (RFC6350 Section 5) . . . . . . . . . . . . . 9 59 3.4.1. VALUE parameter . . . . . . . . . . . . . . . . . . . 10 60 3.4.2. Multi-value Parameters . . . . . . . . . . . . . . . 10 61 3.5. Values (RFC6350 Section 4) . . . . . . . . . . . . . . . 11 62 3.5.1. Text (RFC6350 Section 4.1) . . . . . . . . . . . . . 11 63 3.5.2. URI (RFC6350 Section 4.2) . . . . . . . . . . . . . . 11 64 3.5.3. Date (RFC6350 Section 4.3.1) . . . . . . . . . . . . 11 65 3.5.4. Time (RFC6350 Section 4.3.2) . . . . . . . . . . . . 12 66 3.5.5. Date-Time (RFC6350 Section 4.3.3) . . . . . . . . . . 14 67 3.5.6. Date and/or Time (RFC6350 Section 4.3.4) . . . . . . 15 68 3.5.7. Timestamp (RFC6350 Section 4.3.5) . . . . . . . . . . 16 69 3.5.8. Boolean (RFC6350 Section 4.4) . . . . . . . . . . . . 16 70 3.5.9. Integer (RFC6350 Section 4.5) . . . . . . . . . . . . 17 71 3.5.10. Float (RFC6350 Section 4.6) . . . . . . . . . . . . . 17 72 3.5.11. UTC Offset (RFC6350 Section 4.7) . . . . . . . . . . 17 73 3.5.12. Language Tag (RFC6350 Section 4.8) . . . . . . . . . 17 74 3.6. Extensions (RFC6350 Section 6.10) . . . . . . . . . . . . 18 75 4. Converting from jCard into vCard . . . . . . . . . . . . . . 18 76 5. Handling Unrecognized Properties or Parameters . . . . . . . 18 77 6. Implementation Status (to be removed prior to publication as 78 an RFC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 79 7. Security Considerations . . . . . . . . . . . . . . . . . . . 22 80 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22 81 8.1. GROUP vCard Parameter . . . . . . . . . . . . . . . . . . 23 82 8.2. UNKNOWN vCard Value Data Type . . . . . . . . . . . . . . 23 83 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 23 84 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 24 85 10.1. Normative References . . . . . . . . . . . . . . . . . . 24 86 10.2. Informative References . . . . . . . . . . . . . . . . . 25 87 Appendix A. ABNF Schema . . . . . . . . . . . . . . . . . . . . 25 88 Appendix B. Examples . . . . . . . . . . . . . . . . . . . . . . 27 89 B.1. Example: vCard of the author of RFC6350 . . . . . . . . . 27 90 B.1.1. vCard Data . . . . . . . . . . . . . . . . . . . . . 27 91 B.1.2. jCard Data . . . . . . . . . . . . . . . . . . . . . 27 92 Appendix C. Change History (to be removed prior to publication 93 as an RFC) . . . . . . . . . . . . . . . . . . . . . 29 94 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 30 96 1. Introduction 98 The vCard data format [RFC6350] has gone through multiple revisions, 99 most recently vCard 4. The goal followed by this format is the 100 capture and exchange of information normally stored within an address 101 book or directory application. As certain similarities to the 102 iCalendar data format [RFC5545] exist it makes sense to define a 103 JSON-based data format for vCards that is similar to the jCal format 104 defined in [I-D.ietf-jcardcal-jcal]. 106 The purpose of this specification is to define "jCard", a JSON format 107 for vCard data. One main advantage to using a JSON-based format as 108 defined in [RFC4627] over the classic vCard format is easier 109 processing for JavaScript based widgets and libraries, especially in 110 the scope of web-based applications. 112 The key design considerations are essentially the same as those for 113 [I-D.ietf-jcardcal-jcal] and [RFC6321], that is: 115 Round-tripping (converting a vCard instance to jCard and back) 116 will give the same semantic result as the starting point. For 117 example, all components, properties and property parameters are 118 guaranteed to be preserved. 120 Ordering of elements will not necessarily be preserved. 122 Preserve the semantics of the vCard data. While a simple consumer 123 can easily browse the data in jCard, a full understanding of vCard 124 is still required in order to modify and/or fully comprehend the 125 directory data. 127 Ability to handle many extensions to the underlying vCard 128 specification without requiring an update to this document. 130 2. Conventions Used in This Document 132 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 133 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 134 document are to be interpreted as described in [RFC2119]. 136 The underlying format used for jCard is JSON. Consequently, the 137 terms "object" and "array" as well as the four primitive types are to 138 be interpreted as described in Section 1 of [RFC4627]. 140 Some examples in this document contain "partial" JSON documents used 141 for illustrative purposes. In these examples, three periods "..." 142 are used to indicate a portion of the document that has been removed 143 for compactness. 145 3. Converting from vCard to jCard 147 This section describes how vCard data is converted to jCard using a 148 simple mapping between the vCard data model and JSON elements. 150 3.1. Pre-processing 152 vCard uses a line folding mechanism to limit lines of data to a 153 maximum line length (typically 72 characters) to ensure maximum 154 likelihood of preserving data integrity as it is transported via 155 various means (e.g., email) - see Section 3.2 of [RFC6350]. Prior to 156 converting vCard data into jCard all folded lines MUST be unfolded. 158 vCard data uses an "escape" character sequence for text values and 159 property parameter values. When such text elements are converted 160 into jCard the escaping MUST be removed. See Section 3.4 of 161 [RFC6350]. The only escaping that may be applied is any escaping 162 mandated by JSON. 164 One key difference in the formatting of values used in vCard and 165 jCard is that in jCard the specification uses date/time values 166 aligned with the extended format of [ISO.8601.2004]. The sections of 167 this document describing the various date and time formats contain 168 more information on the use of the complete representation, reduced 169 accuracy or truncated representation. 171 3.2. vCard Stream 173 In certain cases it makes sense to group a sequence of vcard objects 174 into a stream of objects. While the vCard 4 standard doesn't define 175 a stream of vcard objects, having one makes it easier to identify 176 multiple jCard objects and also ensures compatibility to jCal. A 177 jCard stream is identified by an array, where the first element is 178 the string "vcardstream". Subsequent elements are vCard objects 179 represented as described in this document. 181 In the typical case where there is only one vCard object, 182 encapsulation inside a "vcardstream" array MAY be omitted. 184 A vCard stream can contain one or more vCard objects. Each vCard 185 object, delimited by "BEGIN:VCARD" and "END:VCARD", is represented in 186 JSON as a fixed length array with two elements: 188 1. The string "vcard" 190 2. An array of jCard properties 191 The representation of a vCard object in JSON will be named "vcard 192 component" throughout this document. 194 Example: 196 ["vcardstream", 197 ["vcard", 198 [ /* properties */ ] 199 ], 200 ["vcard", 201 [ /* properties */ ] 202 ], 203 ... 204 ] 206 vCard objects are comprised of a set of "properties", "parameters" 207 and "values". The top level of a vCard object contains "properties". 208 A "property" has a "value" and a set of zero or more "parameters". 209 vCard objects are delimited by the general properties "BEGIN" and 210 "END" with the fixed value "VCARD" as defined in Section 6.1.1 and 211 6.1.2 of [RFC6350]. In addition, the vCard format is versioned, 212 therefore the "version" property is mandatory. To comply with 213 Section 6.7.9 of [RFC6350], the value of the version property MUST be 214 "4.0". 216 3.3. Properties (RFC6350 section 6) 218 Each individual vCard property is represented in jCard by an array 219 with three fixed elements, followed by one or more additional 220 elements, depending on if the property is a multi-value property as 221 described in Section 3.3 of [RFC6350]. 223 The array consists of the following fixed elements: 225 1. The name of the property as a string, but in lowercase. 227 2. An object containing the parameters as described in Section 3.4. 229 3. The type identifier string of the value, in lowercase. 231 The remaining elements of the array are used for the value of the 232 property. For single-value properties, the array MUST have exactly 233 four elements, for multi-valued properties as described in 234 Section 3.3.1.1 there can be any number of additional elements. 236 The array describing the property can then be inserted into the array 237 designated for properties in the "vcard" component. 239 Example: 241 ["vcard", 242 [ 243 ["version", {}, "text", "4.0"], 244 ["fn", {}, "text", "John Doe"], 245 ["gender", {}, "text", "M"], 246 ... 247 ], 248 ] 250 The property parameters in the second element of the property array 251 associate a set of parameter names with their respective value. 252 Parameters are further described in Section 3.4. 254 To allow for a cleaner implementation, the parameter object MUST be 255 present even if there are no parameters. In this case, an empty 256 object MUST be used. 258 As described in Section 3.3.1.3, it is important to check the data 259 type of the value even if it is assumed to be a string in most cases. 260 The value could turn out to be a structured value, in which case the 261 type is an array. 263 3.3.1. Special Cases for Properties 265 This section describes some properties that have special handling 266 when converting to jCard. 268 3.3.1.1. Multi-valued Properties 270 Various vCard properties defined in [RFC6350], for example the 271 "CATEGORIES" property, are defined as multi-valued properties. In 272 jCal these properties are added as further members of the array 273 describing the property. 275 Note that additional multi-valued properties may be added in 276 extensions to the iCalendar format. 278 Example: 280 ["vcard", 281 [ 282 ["categories", {}, "text", "computers", "cameras"], 283 ... 284 ], 285 ... 286 ] 288 3.3.1.2. Grouping of Properties 290 [RFC6350] Section 3.3 defines a grouping construct that is used to 291 group related properties together. In jCard, a new GROUP parameter 292 is introduced. Its purpose is to eliminate the need for group syntax 293 in jCard, thus unifying the general syntax with that of jCal. 295 Namespace: 297 Parameter name: GROUP 299 Purpose: To simplify the jCard format. 301 Description: The GROUP parameter is reserved for the exclusive use 302 of the jCard format [RFCTODO] . It MUST NOT be used in plain 303 vCard [RFC6350], nor in xCard [RFC6351]. In jCard, the 304 parameter's value is a single opaque string. Conversion rules are 305 as follows: 307 * From vCard to jCard, the group construct (see [RFC6350], 308 Section 3.3, Page 7) is removed. In its place, the GROUP 309 parameter is added (lowercased, as any other parameter). Its 310 value is a string corresponding to the group name. The name's 311 case MUST be preserved intact. 313 * From jCard to vCard, the reverse procedure is performed. The 314 GROUP parameter MUST NOT appear in the resulting vCard. 316 Format definition: (Not applicable) 318 Example: 320 CONTACT.FN:Mr. John Q. Public\, Esq. 322 is equivalent to: 324 [ "fn", { "group": "CONTACT" }, "text", "Mr. John Q. Public, Esq." ] 326 3.3.1.3. Structured Property Values 328 The vCard specification defines properties with structured values, 329 for example GENDER or ADR. A structured value is defined as a value 330 that contains multiple text components, delimited by the SEMICOLON 331 character. In jCard, the property value is an array containing one 332 element for each text component. 334 vCard Example: 336 ADR:;;Main Street 123;Any Town;CA;91921-1234;U.S.A. 338 jCard Example: 340 ["adr", {}, "text", 341 [ 342 "", "", "Main Street 123", 343 "Any Town", "CA", "91921-1234", "U.S.A." 344 ] 345 ] 347 Some vCard properties, for example ADR, also allow a structured value 348 element that itself has multiple values. In this case, the element 349 of the array describing the structured value is itself an array with 350 one element for each of the component's multiple values. 352 vCard Example: 354 ADR:;;My Street,Left Side,Second Shack;Hometown;PA;18252;U.S.A. 356 jCard Example: 358 ["adr", {}, "text", 359 [ 360 "", 361 "", 362 ["My Street", "Left Side", "Second Shack"], 363 "Hometown", 364 "PA", 365 "18252", 366 "U.S.A." 367 ] 368 ] 369 In both cases, the array element values MUST have the primative type 370 that matches the jCard type identifier. In [RFC6350], there are only 371 structured text values and thus only JSON strings are used. 372 Extensions may for example define structured number or boolean 373 values, where JSON number or boolean types MUST be used. 375 If a multi-valued text component is changed to hold only one value, 376 the text component SHOULD be represented as a single primative value, 377 but MAY be represented as an array with a single primative value. 379 Similarly, structured values that consist of two text components with 380 one being optional (for example, GENDER) MAY be represented as a 381 single text value. Therefore, implementors SHOULD check even known 382 property values for structured information. This is especially 383 important for languages where accessing array members is done by the 384 same construct as accessing characters of a string. 386 Examples: 388 ["gender", {}, "text", ["F", "grrrl"] ], 389 ["gender", {}, "text", "M" ], 391 3.4. Parameters (RFC6350 Section 5) 393 Property parameters are represented as a JSON object where each key- 394 value pair represents the vCard parameter name and its value. The 395 name of the parameter MUST be in lowercase, the original case of the 396 parameter value MUST be preserved. For example, the "LANG" property 397 parameter is represented in jCard by the "lang" key. Any new vCard 398 parameters added in the future will be converted in the same way. 400 Example: 402 ["vcard", 403 [ 404 ["role", { "lang": "tr" }, "text", "roca"], 405 ... 406 ], 407 ... 408 ] 410 3.4.1. VALUE parameter 412 vCard defines a "VALUE" property parameter (Section 5.2 of 413 [RFC6350]). This property parameter MUST NOT be added to the 414 parameters object. Instead, the value type is always explicitly 415 mentioned in the third element of the array describing the property. 416 Thus, when converting from vCard to jCard, any "VALUE" property 417 parameters are skipped. When converting from jCard into vCard, the 418 appropriate "VALUE" property parameter MUST be included in the vCard 419 property if the value type is not "unknown" or the default value type 420 for that property. See Section 5 for information on handling unknown 421 value types. 423 3.4.2. Multi-value Parameters 425 In [RFC6350], some parameters allow using a COMMA-separated list of 426 values. To ease processing in jCard, the value to such parameters 427 MUST be represented in an array containing the separated values. The 428 array elements MUST be string values. Single-value parameters SHOULD 429 be represented using a single string value, but an array with one 430 element MAY also be used. An example for a such parameter is the 431 vCard "SORT-AS" parameter, more such parameters may be added in 432 extensions. 434 DQUOTE characters used to encapsulate the separated values MUST NOT 435 be added to the jCard parameter value. 437 Example 1: 439 ["vcard", 440 [ 441 ["n", 442 { "sort-as": ["Harten", "Rene"] }, 443 "text", 444 "van der Harten;Rene,J.;Sir;R.D.O.N." 445 ], 446 ["fn", {}, "text", "Rene van der Harten"] 447 ... 448 ], 449 ... 450 ] 452 3.5. Values (RFC6350 Section 4) 454 The type of a vCard value is explicitly mentioned in the third 455 element of the array describing a jCard property. The actual values 456 of the property can be found in the fourth and following elements of 457 the array. 459 3.5.1. Text (RFC6350 Section 4.1) 461 Description: vCard "TEXT" property values are represented by a 462 property with the type identifier "text". The value elements are 463 JSON strings. For details on structured text values, see 464 Section 3.3.1.3. 466 Example: 468 ... 469 ["kind", {}, "text", "group"], 470 ... 472 3.5.2. URI (RFC6350 Section 4.2) 474 Description: vCard "URI" property values are represented by a 475 property with the type identifier "uri". The value elements are 476 JSON strings. 478 Example: 480 ... 481 ["source", {}, "uri", "ldap://ldap.example.com/cn=babs%20jensen"], 482 ... 484 3.5.3. Date (RFC6350 Section 4.3.1) 486 Description: vCard "DATE" property values are represented by a 487 property with the type identifier "date". The value elements are 488 JSON strings with the same date value specified by [RFC6350], but 489 represented using the extended format specified in 490 [ISO.8601.2004], Section 4.1.2. If the complete representation is 491 not used, the same date format restrictions regarding reduced 492 accuracy, truncated representation and expanded representation 493 noted in [RFC6350] Section 4.1.2.3 apply. Whenever the extended 494 format is not applicable, the basic format MUST be used. 496 ABNF Schema: 498 date-complete = year "-" month "-" day ;YYYY-MM-DD 500 date-noreduc = date-complete 501 / "--" month "-" day; --MM-DD 502 / "---" day; ---DDD 504 date = date-noreduc 505 / year; YYYY 506 / year "-" month ; YYYY-MM 507 / "--" month; --MM 509 Examples: 511 ... 512 ["bday", {}, "date", "1985-04-12"], 513 ["bday", {}, "date", "1985-04"], 514 ["bday", {}, "date", "1985"], 515 ["bday", {}, "date", "--04-12"], 516 ["bday", {}, "date", "---12"], 517 ... 519 This table contains possible converisions between the vCard DATE 520 format its jCard date. This information is to be seen as an 521 informative reference, the normative reference is [ISO.8601.2000] and 522 [ISO.8601.2004]: 524 +-----------+----------+------------+ 525 | | vCard | jCard | 526 +-----------+----------+------------+ 527 | Complete | 19850412 | 1985-04-12 | 528 | | | | 529 | Reduced | 1985-04 | 1985-04 | 530 | | | | 531 | Reduced | 1985 | 1985 | 532 | | | | 533 | Truncated | --0412 | --04-12 | 534 | | | | 535 | Truncated | --04 | --04 | 536 | | | | 537 | Truncated | ---12 | ---12 | 538 +-----------+----------+------------+ 540 3.5.4. Time (RFC6350 Section 4.3.2) 541 Description: vCard "TIME" property values are represented by a 542 property with the type identifier "time". The value elements are 543 JSON strings with the same time value specified by [RFC6350], but 544 represented using the extended format specified in 545 [ISO.8601.2004], Section 4.2. If the complete representation is 546 not used, the same time format restrictions regarding reduced 547 accuracy, decimal fraction and truncated representation noted in 548 [RFC6350] Section 4.3.2 apply. Whenever the extended format is 549 not applicable, the basic format MUST be used. The seconds value 550 of 60 MUST only be used to account for positive "leap" seconds and 551 the midnight hour is always represented by 00, never 24. 552 Fractions of a second are not supported by this format. Contrary 553 to [I-D.ietf-jcardcal-jcal], UTC offsets are permitted within a 554 time value. 556 ABNF Schema: 558 time-notrunc = hour [":" minute [":" second]] [zone] 560 time = time-notrunc 561 / "-" minute ":" second [zone]; -mm:ss 562 / "-" minute [zone]; -mm 563 / "--" second [zone]; --ss 565 Examples: 567 ... 568 ["x-time-local", {}, "time", "12:30:00"], 569 ["x-time-utc", {}, "time", "12:30:00Z"], 570 ["x-time-offset", "time", "12:30:00-08:00"], 571 ["x-time-reduced", "time", "23"], 572 ["x-time-truncated", "time", "-30"], 573 ... 575 This table contains possible converisions between the vCard TIME 576 format its jCard time.This information is to be seen as an 577 informative reference, the normative reference is [ISO.8601.2000] and 578 [ISO.8601.2004]: 580 +-----------+--------+----------+ 581 | | vCard | jCard | 582 +-----------+--------+----------+ 583 | Complete | 232050 | 23:20:50 | 584 | | | | 585 | Reduced | 2320 | 23:20 | 586 | | | | 587 | Reduced | 23 | 23 | 588 | | | | 589 | Truncated | -2050 | -20:50 | 590 | | | | 591 | Truncated | -20 | -20 | 592 | | | | 593 | Truncated | --50 | --50 | 594 +-----------+--------+----------+ 596 Also, all combinations may have any zone designator appended, as in 597 the complete representation. 599 3.5.5. Date-Time (RFC6350 Section 4.3.3) 601 Description: vCard "DATE-TIME" property values are represented by a 602 property with the type identifier "date-time". The value elements 603 are JSON strings with the same date value specified by [RFC6350], 604 but represented using the extended format specified in 605 [ISO.8601.2004], Section 4.3. If the complete representation is 606 not used, the same date and time format restrictions as in 607 Section 3.5.4 and Section 3.5.3 apply. Just as in [RFC6350], 608 truncation of the date part is permitted. 610 Example: 612 ... 613 ["anniversary", {}, "date-time", "2013-02-14T12:30:00"], 614 ["anniversary", {}, "date-time", "2013-01-10T19:00:00Z"], 615 ["anniversary", {}, "date-time", "2013-08-15T09:45:00+01:00"], 616 ["anniversary", {}, "date-time", "---15T09:45:00+01:00"], 617 ... 619 This table contains possible converisions between the vCard DATE-TIME 620 format its jCard date-time. This information is to be seen as an 621 informative reference, the normative reference is [ISO.8601.2000] and 622 [ISO.8601.2004]: 624 +----------------+----------------------+---------------------------+ 625 | Representation | vCard | jCard | 626 +----------------+----------------------+---------------------------+ 627 | Complete | 19850412T232050 | 1985-04-12T23:20:50 | 628 | | | | 629 | Complete | 19850412T232050Z | 1985-04-12T23:20:50Z | 630 | | | | 631 | Complete | 19850412T232050+0400 | 1985-04-12T23:20:50+04:00 | 632 | | | | 633 | Complete | 19850412T232050+04 | 1985-04-12T23:20:50+04 | 634 | | | | 635 | Reduced | 19850412T2320 | 1985-04-12T23:20 | 636 | | | | 637 | Reduced | 19850412T23 | 1985-04-12T23 | 638 | | | | 639 | Truncated and | --0412T2320 | --04-12T23:20 | 640 | Reduced | | | 641 | | | | 642 | Truncated and | --04T2320 | --04T23:20 | 643 | Reduced | | | 644 | | | | 645 | Truncated and | ---12T2320 | ---12T23:20 | 646 | Reduced | | | 647 | | | | 648 | Truncated and | --0412T2320 | --04-12T23:20 | 649 | Reduced | | | 650 | | | | 651 | Truncated and | --04T23 | --04T23 | 652 | Reduced | | | 653 +----------------+----------------------+---------------------------+ 655 As specified in [ISO.8601.2000], the date component shall not be 656 represented with reduced accuracy and the time component shall not be 657 truncated. Also, all combinations may have any zone designator 658 appended, as in the complete representation. 660 3.5.6. Date and/or Time (RFC6350 Section 4.3.4) 662 Description: vCard "DATE-AND-OR-TIME" property values are 663 represented by a property with the type identifier "date-and-or- 664 time". The value elements are either a date-time (Section 3.5.5), 665 a date (Section 3.5.3) or a time (Section 3.5.4) value. Just as 666 in [RFC6350] Section 4.3.4, a stand-alone time value MUST always 667 be preceded by a "T". 669 Example: 671 ... 672 ["bday", {}, "date-and-or-time", "2013-02-14T12:30:00"], 673 ["bday", {}, "date-and-or-time", "---22T14:00"] 674 ["bday", {}, "date-and-or-time", "1985"], 675 ["bday", {}, "date-and-or-time", "T12:30"], 676 ... 678 3.5.7. Timestamp (RFC6350 Section 4.3.5) 680 Description: vCard "TIMESTAMP" property values are represented by a 681 property with the type identifier "timestamp". The value elements 682 are JSON strings with the same timestamp value specified by 683 [RFC6350], but represented using the extended format and complete 684 representation specified in [ISO.8601.2004], Section 4.3.2. 686 Example: 688 ... 689 ["rev", {}, "timestamp", "2013-02-14T12:30:00"], 690 ["rev", {}, "timestamp", "2013-02-14T12:30:00Z"], 691 ["rev", {}, "timestamp", "2013-02-14T12:30:00-05"], 692 ["rev", {}, "timestamp", "2013-02-14T12:30:00-05:00"], 693 ... 695 This table contains possible converisions between the vCard TIMESTAMP 696 format its jCard timestamp. This information is to be seen as an 697 informative reference, the normative reference is [ISO.8601.2000] and 698 [ISO.8601.2004]: 700 +----------------+----------------------+---------------------------+ 701 | Representation | vCard | jCard | 702 +----------------+----------------------+---------------------------+ 703 | Complete | 19850412T232050 | 1985-04-12T23:20:50 | 704 | | | | 705 | Complete | 19850412T232050Z | 1985-04-12T23:20:50Z | 706 | | | | 707 | Complete | 19850412T232050+0400 | 1985-04-12T23:20:50+04:00 | 708 | | | | 709 | Complete | 19850412T232050+04 | 1985-04-12T23:20:50+04 | 710 +----------------+----------------------+---------------------------+ 712 3.5.8. Boolean (RFC6350 Section 4.4) 714 Description: vCard "BOOLEAN" property values are represented by a 715 property with the type identifier "boolean". The value element is 716 a JSON boolean value. 718 Example: 720 ... 721 ["x-non-smoking", {}, "boolean", true], 722 ... 724 3.5.9. Integer (RFC6350 Section 4.5) 726 Description: vCard "INTEGER" property values are represented by a 727 property with the type identifier "integer". The value elements 728 are JSON primitive number values. 730 Examples: 732 ... 733 ["x-karma-points", {}, "integer", 42], 734 ... 736 3.5.10. Float (RFC6350 Section 4.6) 738 Description: vCard "FLOAT" property values are represented by a 739 property with the type identifier "float". The value elements are 740 JSON primitive number values. 742 Example: 744 ... 745 ["x-grade", {}, "float", 1.3], 746 ... 748 3.5.11. UTC Offset (RFC6350 Section 4.7) 750 Description: vCard "UTC-OFFSET" property values are represented by a 751 property with the type identifier "utc-offset". The value 752 elements are JSON strings with the same UTC offset value specified 753 by [RFC6350], with the exception that the hour and minute 754 components are separated by a ":" character, for consistency with 755 the [ISO.8601.2004] timezone offset, extended format. 757 Example: 759 ... 760 // Note: [RFC6350] mentions use of utc-offset 761 // for the TZ property as NOT RECOMMENDED 762 ["tz", {}, "utc-offset", "-05:00"], 763 .. 765 3.5.12. Language Tag (RFC6350 Section 4.8) 766 Description: vCard "LANGUAGE-TAG" property values are represented by 767 a property with the type identifier "language-tag". The value 768 elements are JSON strings containing a single language-tag, as 769 defined in [RFC5646]. 771 Example: 773 ... 774 ["lang", {}, "language-tag", "de"], 775 .. 777 3.6. Extensions (RFC6350 Section 6.10) 779 vCard extension properties and property parameters (those with an 780 "X-" prefix in their name) are handled in the same way as other 781 properties and property parameters: the property is represented by an 782 array, the property parameter represented by an object. The property 783 or parameter name uses the same name as for the vCard extension, but 784 in lowercase. For example, the "X-FOO" property in vCard turns into 785 the "x-foo" jCard property. See Section 5 for how to deal with 786 default values for unrecognized extension properties or property 787 parameters. 789 4. Converting from jCard into vCard 791 When converting property and property parameter values, the names 792 SHOULD be converted to uppercase. Although vCard names are case 793 insensitive, common practice is to keep them all uppercase following 794 the actual definitions in [RFC6350]. 796 Backslash escaping and line folding MUST be applied to the resulting 797 vCard data as required by [RFC6350]. 799 When converting to vCard, the VALUE parameter MUST be added to 800 properties whose default value type is unknown. The VALUE parameter 801 SHOULD NOT be added to properties using the default value type. 803 5. Handling Unrecognized Properties or Parameters 805 In vCard, properties have a default value type specified by their 806 definition, e.g. "BDAY"'s value type is "date-and-or-time", but it 807 can also be reset to a single "text" value. When a property uses its 808 default value type, the "VALUE" property parameter does not need to 809 be specified on the property. 811 When new properties are defined or "X-" properties used, a vCard to 812 jCard converter might not recognize them, and not know what the 813 appropriate default value types are, yet they need to be able to 814 preserve the values. A similar issue arises for unrecognized 815 property parameters. 817 In jCard, a new UNKNOWN property value type is introduced. Its 818 purpose is to allow preserving unknown property types when 819 roundtripping between jCard and vCard. 821 Value Data Type name: UNKNOWN 823 Purpose: To allow preserving unknown property types during 824 roundtripping 826 Description: The UNKNOWN value data type is reserved for the 827 exclusive use of the jCard format [RFCTODO] . It MUST NOT be used 828 in plain vCard [RFC6350]. Conversion rules are as follows: 830 * When converting vCard into jCard: 832 + Any property that does not include a "VALUE" property 833 parameter and whose default value type is not known, MUST be 834 converted to a primative JSON string. The content of that 835 string is the unprocessed value text. Also, value type MUST 836 be set to "unknown". 838 + To correctly implement this format, it is critical that if 839 the default type is not known that the type "unknown" is 840 used. If this requirement is ignored and for example "text" 841 is used, additional escaping may occur which breaks 842 roundtripping values. 844 + Any unrecognized property parameter MUST be converted to a 845 string value, with its content set to the property parameter 846 value text, treated as if it were a "TEXT" value. 848 * When converting jCard into vCard: 850 + Since jCard always explicitly specifies the value type, it 851 can always be converted to vCard using the VALUE parameter. 853 + If the value type specified in jCard matches the default 854 value type in vCard, the VALUE parameter SHOULD be omitted. 856 + If the valye type specified in jCard is set to "unknown", 857 the value MUST be taken over in vCard without proessing. In 858 this case, the VALUE parameter MUST NOT be specified. 860 Format definition: (Not applicable) 862 Example: The following is an example of an unrecognized vCard 863 property (that uses an "URI" value as its default), and the 864 equivalent jCard representation of that property. 866 vCard: 868 X-COMPLAINT-URI:mailto:abuse@example.org 870 jCard: 872 ... 873 ["x-complaint-uri", {}, "unknown", "mailto:abuse@example.org"], 874 ... 876 Example: The following is an example of how to cope with jCard data 877 where the parser was unable to identify the type. Note how the 878 "unknown" value type is not added to the vCard data and escaping, 879 aside from standard JSON string escaping, is not processed. 881 jCard: 883 ... 884 ["x-coffee-data", {}, "unknown", "Stenophylla;Guinea\\,Africa"], 885 ... 887 vCard: 889 X-COFFEE-DATA:Stenophylla;Guinea\,Africa 891 Example: The following is an example of a jCard property (where the 892 corresponding vCard property uses a "INTEGER" value as its default), 893 and the equivalent vCard representation of that property. It is 894 assumed that the parser has knowledge of the default data type for 895 the "x-karma-points" property. 897 jCard: 899 ... 900 ["x-karma-points", {}, "integer", 95], 901 ... 903 vCard: 905 X-KARMA-POINTS:95 907 Example: The following is an example of an unrecognized vCard 908 property parameter (that uses a "FLOAT" value as its default) 909 specified on a recognized vCard property, and the equivalent jCard 910 representation of that property and property parameter. 912 vCard: 914 GENDER;X-PROBABILITY=0.8:M 916 jCard: 918 ... 919 ["gender", { "x-probability": "0.8" }, "text", "M"], 920 ... 922 6. Implementation Status (to be removed prior to publication as an RFC) 924 This section describes libraries known to implement this draft as per 925 [I-D.sheffer-running-code]. 927 1. ICAL.js - Philipp Kewisch, James Lal. A JavaScript parser for 928 iCalendar (rfc5545) 930 Source: https://github.com/mozilla-comm/ical.js/ 932 Maturity: alpha (for jCard) 934 Coverage: Currently geared towards jCal, therefore not all 935 formats are supported. Includes an online validator. (as 936 of rev 847c67c501, 2013-02-14) 938 Licensing: MPL, Mozilla Public License 2.0 940 2. Py Calendar - Cyrus Daboo. iCalendar/vCard Library 942 Source: https://svn.calendarserver.org/repository/calendarserver 943 /PyCalendar/branches/json/ 945 Maturity: production 947 Coverage: All aspects of this draft, up to version 01. 949 Licensing: Apache License, Version 2.0 951 3. ez-vcard - Michael Angstadt. A vCard parser library written in 952 Java 954 Source: https://code.google.com/p/ez-vcard/ 956 Maturity: production 958 Coverage All aspects of this draft. 960 Licensing: New BSD License 962 Additionally, interoperability testing of this draft is an ongoing 963 effort under members of calconnect, the Calendaring and Scheduling 964 Consortium. CalDAV Vendors are looking into supporting this draft. 966 7. Security Considerations 968 For security considerations specific to calendar data, see Section 9 969 of [RFC6350]. Since this specification is a mapping from vCard, no 970 new security concerns are introduced related to calendar data. 972 The use of JSON as a format does have security risks. Section 7 of 973 [RFC4627] discusses these risks. 975 8. IANA Considerations 977 This document defines a MIME media type for use with vCard in JSON 978 data. This media type SHOULD be used for the transfer of calendaring 979 data in JSON. 981 Type name: application 983 Subtype name: vcard+json 985 Required parameters: none 987 Optional parameters: version as defined for the text/vcard media 988 type in [RFC6350]. 990 Encoding considerations: Same as encoding considerations of 991 application/json as specified in [RFC4627]. 993 Security considerations: See Section 7. 995 Interoperability considerations: This media type provides an 996 alternative format for vCard data based on JSON. 998 Published specification: This specification. 1000 Applications which use this media type: Applications that currently 1001 make use of the text/vcard media type can use this as an 1002 alternative. Similarly, Applications that use the application/ 1003 json media type to transfer directory data can use this to further 1004 specify the content. 1006 Person & email address to contact for further information: 1007 vcarddav@ietf.org 1009 Intended usage: COMMON 1011 Restrictions on usage: There are no restrictions on where this media 1012 type can be used. 1014 Author: See the "Author's Address" section of this document. 1016 Change controller: IETF 1018 8.1. GROUP vCard Parameter 1020 IANA has added the following entry to the vCard Parameters registry, 1021 defined in Section 10.3.2 of [RFC6350]. 1023 +-----------+-----------+-----------------------------+ 1024 | Namespace | Parameter | Reference | 1025 +-----------+-----------+-----------------------------+ 1026 | | GROUP | RFCTODO, Section 3.3.1.2. | 1027 +-----------+-----------+-----------------------------+ 1029 8.2. UNKNOWN vCard Value Data Type 1031 IANA has added the following entry to the vCard Data Types registry, 1032 defined in Section 10.3.3 of [RFC6350]. 1034 +-----------------+-----------------------+ 1035 | Value Data Type | Reference | 1036 +-----------------+-----------------------+ 1037 | UNKNOWN | RFCTODO, Section 5. | 1038 +-----------------+-----------------------+ 1040 9. Acknowledgments 1042 The author would like to thank the following for their valuable 1043 contributions: Cyrus Daboo, Mike Douglass, William Gill, Erwin Rehme, 1044 and Dave Thewlis. This specification originated from the work of the 1045 XML-JSON technical committee of the Calendaring and Scheduling 1046 Consortium. 1048 10. References 1050 10.1. Normative References 1052 [I-D.ietf-jcardcal-jcal] 1053 Kewisch, P., Daboo, C., and M. Douglass, "jCal: The JSON 1054 format for iCalendar", draft-ietf-jcardcal-jcal-00 (work 1055 in progress), March 2013. 1057 [ISO.8601.2000] 1058 International Organization for Standardization, ""Data 1059 elements and interchange formats -- Information 1060 interchange -- Representation of dates and times" ", ISO 1061 8601, 12 2000. 1063 [ISO.8601.2004] 1064 International Organization for Standardization, ""Data 1065 elements and interchange formats -- Information 1066 interchange -- Representation of dates and times" ", ISO 1067 8601, 12 2004. 1069 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1070 Requirement Levels", BCP 14, RFC 2119, March 1997. 1072 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 1073 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1075 [RFC5545] Desruisseaux, B., "Internet Calendaring and Scheduling 1076 Core Object Specification (iCalendar)", RFC 5545, 1077 September 2009. 1079 [RFC5646] Phillips, A. and M. Davis, "Tags for Identifying 1080 Languages", BCP 47, RFC 5646, September 2009. 1082 [RFC6321] Daboo, C., Douglass, M., and S. Lees, "xCal: The XML 1083 Format for iCalendar", RFC 6321, August 2011. 1085 [RFC6350] Perreault, S., "vCard Format Specification", RFC 6350, 1086 August 2011. 1088 [RFC6351] Perreault, S., "xCard: vCard XML Representation", RFC 1089 6351, August 2011. 1091 10.2. Informative References 1093 [I-D.sheffer-running-code] 1094 Sheffer, Y. and A. Farrel, "Improving Awareness of Running 1095 Code: the Implementation Status Section", draft-sheffer- 1096 running-code-02 (work in progress), January 2013. 1098 [RFC4627] Crockford, D., "The application/json Media Type for 1099 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 1101 [calconnect-artifacts] 1102 The Calendaring and Scheduling Consortium, "Code Artifacts 1103 and Schemas", , 1104 . 1106 Appendix A. ABNF Schema 1108 Below is an ABNF schema as per [RFC5234] for vCard in JSON. ABNF 1109 Symbols not described here are taken from [RFC4627]. The schema is 1110 non-normative and given for reference only. 1112 The numeric section numbers given in the comments refer to section in 1113 [RFC6350]. Additional semantic restrictions apply, especially 1114 regarding the allowed properties and sub-components per component. 1115 Details on these restrictions can be found in this document and 1116 [RFC6350]. 1118 Additional schemas may be available on the internet at 1119 [calconnect-artifacts]. 1121 ; A vCard Stream is an array with the first element being the 1122 ; string "vcardstream". All remaining elements are jcardobjects. 1123 jcardstream = begin-array 1124 DQUOTE "vcardstream" DQUOTE 1125 *(value-separator jcardobject) 1126 end-array 1128 jcardobject = component 1130 ; A jCard object consists of the name string "vcard" and a properties 1131 ; array. Restrictions to which properties and may be specified are to 1132 ; be taken from RFC6350. 1133 jcardobject = begin-array 1134 DQUOTE component-name DQUOTE value-separator 1135 properties-array 1136 end-array 1138 ; A jCard property consists of the name string, parameters object, 1139 ; type string and one or more values as specified in this document. 1140 property = begin-array 1141 DQUOTE property-name DQUOTE value-separator 1142 params-object value-separator 1143 DQUOTE type-name DQUOTE 1144 propery-value *(value-separator property-value) 1145 end-array 1146 properties-array = begin-array 1147 [ property *(value-separator property) ] 1148 end-array 1150 ; Property values depend on the type-name. Aside from the value types 1151 ; mentioned here, extensions may make use of other JSON value types. 1152 property-value = simple-prop-value / structured-prop-value 1153 simple-prop-value = string / number / boolean 1154 structured-prop-value = 1155 begin-array 1156 [ structured-element *(value-separator structured-element) ] 1157 end-array 1159 ; Each structured element may have multiple values if 1160 ; semantically allowed 1161 structured-element = simple-prop-value / structured-multi-prop 1162 structured-multi-prop = 1163 begin-array 1164 [ simple-prop-value *(value-separator simple-prop-value) ] 1165 end-array 1167 ; The jCard params-object is a JSON object which follows the semantic 1168 ; guidelines described in this document. 1169 params-object = begin-object 1170 [ params-member *(value-separator params-member) ] 1171 end-object 1172 params-member = DQUOTE param-name DQUOTE name-separator param-value 1173 param-value = string / param-multi 1174 param-multi = begin-array 1175 [ string *(value-separtor string) ] 1176 end-array 1178 ; The type MUST be a valid type as described by this document. New 1179 ; value types can be added by extensions. 1180 type-name = "text" / "uri" / "date" / "time" / "date-time" / 1181 "boolean" / "integer" / "float" / "utc-offset" / 1182 "language-tag" / x-type 1184 ; Property, parameter and type names MUST be lowercase. Additional 1185 ; semantic restrictions apply as described by this document and 1186 ; RFC6350. 1187 component-name = lowercase-name 1188 property-name = lowercase-name 1189 param-name = lowercase-name 1190 x-type = lowercase-name 1191 lowercase-name = 1*(%x61-7A / DIGIT / "-") 1193 Appendix B. Examples 1195 This section contains an example of a vCard object with its jCard 1196 representation. 1198 B.1. Example: vCard of the author of RFC6350 1200 B.1.1. vCard Data 1202 BEGIN:VCARD 1203 VERSION:4.0 1204 FN:Simon Perreault 1205 N:Perreault;Simon;;;ing. jr,M.Sc. 1206 BDAY:--0203 1207 ANNIVERSARY:20090808T1430-0500 1208 GENDER:M 1209 LANG;PREF=1:fr 1210 LANG;PREF=2:en 1211 ORG;TYPE=work:Viagenie 1212 ADR;TYPE=work:;Suite D2-630;2875 Laurier; 1213 Quebec;QC;G1V 2M2;Canada 1214 TEL;VALUE=uri;TYPE="work,voice";PREF=1:tel:+1-418-656-9254;ext=102 1215 TEL;VALUE=uri;TYPE="work,cell,voice,video,text":tel:+1-418-262-6501 1216 EMAIL;TYPE=work:simon.perreault@viagenie.ca 1217 GEO;TYPE=work:geo:46.772673,-71.282945 1218 KEY;TYPE=work;VALUE=uri: 1219 http://www.viagenie.ca/simon.perreault/simon.asc 1220 TZ:-0500 1221 URL;TYPE=home:http://nomis80.org 1222 END:VCARD 1224 B.1.2. jCard Data 1226 ["vcard", 1227 [ 1228 ["version", {}, "text", "4.0"], 1229 ["fn", {}, "text", "Simon Perreault"], 1230 ["n", 1231 {}, 1232 "text", 1233 ["Perreault", "Simon", "", "", ["ing. jr", "M.Sc."]] 1234 ], 1235 ["bday", {}, "date-and-or-time", "--02-03"], 1236 ["anniversary", 1237 {}, 1238 "date-and-or-time", 1239 "2009-08-08T14:30:00-05:00" 1240 ], 1241 ["gender", {}, "text", "M"], 1242 ["lang", { "pref": "1" }, "language-tag", "fr"], 1243 ["lang", { "pref": "2" }, "language-tag", "en"], 1244 ["org", { "type": "work" }, "text", "Viagenie"], 1245 ["adr", 1246 { "type": "work" }, 1247 "text", 1248 [ 1249 "", 1250 "Suite D2-630", 1251 "2875 Laurier", 1252 "Quebec", 1253 "QC", 1254 "G1V 2M2", 1255 "Canada" 1256 ] 1257 ], 1258 ["tel", 1259 { "type": ["work", "voice"], "pref": "1" }, 1260 "uri", 1261 "tel:+1-418-656-9254;ext=102" 1262 ], 1263 ["tel", 1264 { "type": ["work", "cell", "voice", "video", "text"] }, 1265 "uri", 1266 "tel:+1-418-262-6501" 1267 ], 1268 ["email", 1269 { "type": "work" }, 1270 "text", 1271 "simon.perreault@viagenie.ca" 1272 ], 1273 ["geo", { "type": "work" }, "uri", "geo:46.772673,-71.282945"], 1274 ["key", 1275 { "type": "work" }, 1276 "uri", 1277 "http://www.viagenie.ca/simon.perreault/simon.asc" 1278 ], 1279 ["tz", {}, "utc-offset", "-05:00"], 1281 ["url", { "type": "home" }, "uri", "http://nomis80.org"] 1282 ] 1283 ] 1285 Appendix C. Change History (to be removed prior to publication as an 1286 RFC) 1288 draft-kewisch-vcard-in-json-01 1290 * Added ABNF and improved references in date/time related 1291 sections 1293 * Changes to wording in "vCard Stream" section 1295 * Changes to wording about VALUE parameter when converting to 1296 vCard 1298 * Corrected missing "type" parameter and separator in example 1300 * Minor wording corrections 1302 draft-ietf-jcardcal-jcard-00 1304 * Pubication as a WG draft 1306 draft-ietf-jcardcal-jcard-01 1308 * Changed grouping syntax to use new GROUP parameter and added 1309 respective IANA section 1311 * Added timestamp and date-and-or-time types instead of 1312 converting them from date/time/date-time 1314 * Added a further sentence on preprocessing and escaping to 1315 clarify that JSON escaping must be used. 1317 * Described how to handle structured text values and structured 1318 text components with multiple values. 1320 * Corrections and additions to the ABNF Section, adaptions to 1321 example 1323 draft-ietf-jcardcal-jcard-02 1325 * Made more clear that complete representation is not mandatory 1327 * Added sheffer-running-code section 1328 * Changed handling of unknown property parameter types. 1330 * Minor corrections to sections regarding dates, fixing typos 1332 Author's Address 1334 Philipp Kewisch 1335 Mozilla Corporation 1336 650 Castro Street, Suite 300 1337 Mountain View, CA 94041 1338 USA 1340 EMail: mozilla@kewis.ch 1341 URI: http://www.mozilla.org/