JSON-EIM Specification
EIM-JSON is a JSON serialization of Chandler EIM records.
Schema
Since I am not aware of anything like
RELAX NG for describing JSON schemas (if that term is even accurate in this context), I will attempt to explain the format here in plain English by building a record set from the outermost elements towards the innermost.
Record Sets
EIM-JSON documents consist of a single record set related to a single item. The record set is represented as a JSON object with three properties - one for the uid, one for the deleted-records, and one for the "normal" (non-deleted) records.
The uid property's key is "uid" and the value is a string representing the uid of the item in question.
The deleted record property's key is "deletedRecords" and the value is an array of strings, each string representing the prefix of a record type which is deleted.
The record property's key is "records and the value is an object whose keys are the prefixes of the records in an item and whose values are the records (whose format will be described later in this document.)
A record set:
{
uid: "132123123-123123-123123",
records: { note: {/* note record */}, task: {/*task record*/} },
deletedRecords: [ "deletedStamp1", "deletedStamp2" ]
}
Records
Records are represented as JSON objects with the following properties:
An "ns" property representing the namespace of the record in a string.
A "keys" property representing the key fields of the record, represented as an object whose keys are the names of the fields and whose values are the fields represented as objects (whose format shall be described in a subsequent section.)
A "fields" property representing the non-key, non-deleted fields of the record, represented as an object whose keys are the names of the fields and whose values are the fields represented as objects (whose format shall be described in a subsequent section.)
A "missingFields" property representing the missing fields of the record, represented as an array of strings which are the names of the fields that are missing.
A record:
{
ns: "http://osafoundation.org/eim/item/0",
keys: { uuid: [/*field data*/] },
fields: { title: [/*field data*/],
startDate: [/*field data*/],
endDate [/*field data*/],
},
missingFields: ["location", "rrule"]
}
Fields
A field is a fixed length JSON Array with two entries.
The first is a string representing the EIM type of the field.
The second is a string containing the string representation of the value of the field, or null.
A single field:
["text", "Don't forget the milk...again!"]
Putting it all together
Here is a small, but complete record set with none of the properties elided.
A complete record set:
{
uid: "132123123-123123-123123",
records: {
event: {
ns: "http://osafoundation.org/eim/item/0",
keys: { uuid: ["text", "123123123-123123-123123"] },
fields: { title: ["text", "My Event"],
startDate: ["text", ";VALUE=DATE-TIME:20070212T074500"],
duration: ["text", "PT1H"],
},
missingFields: ["location", "rrule"]
},
},
deletedRecords: [ "deletedStamp1", "deletedStamp2" ]
}
Notes
This document is relatively incomplete at this point, especially when compared to the
EIMML Spec. Most things that are not XML specific in that document however apply to EIM-JSON as well - sections like "Extensibility" and "Partial Records and Record Sets".
References
EIMML Spec
Changes