jcard: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
Line 42: Line 42:
   ]
   ]


* 7. A type property must not be the only property of an Object.
* A type property must not be the only property of an Object.


   // Wrong
   // Wrong

Revision as of 00:24, 4 April 2008

jCard 0.1

A jCard is a standardized representation of an hCard encoded in JSON.

Introduction

A jCard is a standardized representation of an hCard encoded in JSON. The primary aim of a jCard is to provide a standardized JSON output in Microformat parsers to allow for easier interchange and integration with other applications.

The term jCard was first coined by Jon Sykes und Jim Barraud of the MicroJSON project. The MicroJSON wiki was also the first to come up with a standard for this format. This standard however is incomplete and inconsistent in regards to property names and structure. The specification presented here is a completely new attempt at defining a standard representation and only borrows the name from the original jCard specification at MicroJSON.org.

The specification is considered a draft. Contents are subject to change. It is provided here for reference and a basis for discussion on the mailing list.

Format

Authoring rules

  • The structure of a jCard follows the structure of an hCard in regard to nesting elements.
  • All property names must be consistent with their equivalents in hCard.
  • All property names must be enclosed with quotes to allow hyphenated properties.
  • Singular instance properties use only their corresponding datatype for value:
 // Correct
 n = { givenName: 'John', familyName: 'Doe'}
 fn = 'John Doe'
 
 // Wrong
 n = [ {givenName: 'John'}, {familyName: 'Doe'} ]
 fn = {value: 'John Doe'}
  • All properties that may have multiple instances use an Array of their corresponding datatype.
 // Correct
 nickname = ['Rio Demonhog', 'Gus Aspara']
  • Properties that are not set must be omitted.
 // Correct
 email = [
   {type: ['pref'], value: 'foo at example.com'},
   {value: 'bar at example.com'}
 ]
  • A type property must not be the only property of an Object.
 // Wrong
 email = [{type: 'pref'}]

The following is still undecided and needs further discussion

  • a) Enclosing Arrays or Objects must NOT be reduced.
 // Wrong
 email = 'bar at example.com'
 // Correct
 email = [{value: 'bar at example.com'}]

or

  • b) Enclosing Arrays or Objects MUST be reduced
 // Wrong
 email = [{value: 'bar at example.com'}]
 nickname = ['Gogo Fiasco']
 // Correct
 email = 'bar at example.com'
 email = [
   {type: ['pref'], value: 'foo at example.com'},
   'foobar at example.com'
 ]
 nickname = 'Gogo Fiasco'

Field and Element Details

[ This section is a placeholder and should be replaced with field descriptions ]

References