Just to kick of some discussion, here is an overview of the mapping I did from Atom plus adding the OpenSearch specific values. This is *very* early stages and I’m hoping I can find something that can do the general Atom to JSON parsing (Kevin Marks pointed me at the Universal Feed Parser which can print out JSON from a feed so that needs to be checked out – but I need to go somewhere now and don’t have time this evening).
---------------
The basic properties of the JSON format map pretty much directly to the equivalent Atom format as shown below.
At the top level, there are a bunch of properties that map to the feed element.
- author
Maps to the Atom author type and is an array of person instances.
- category
Maps to the Atom category type and is an array of category instances.
- contributor
Maps to the Atom contributor type and is This is an array of person instances.
- entry
Maps to the Atom entry type and contains list of entry types as discussed below.
- extension
Maps to the Atom extensionElement and is an array of extension instances discussed below.
- generator
Maps to the Atom generator type.
- icon
Maps to the Atom icon type.
- id
Maps to the Atom id type.
- lang
Maps to the xml:lang type on the Atom feed.
- link
Maps to the Atom link type and is an array of link instances.
- logo
Maps to the Atom logo type.
- rights
Maps to the Atom rights type.
- subtitle
Maps to the Atom subtitle type.
- title
Maps to the Atom title type.
- updated
Maps to the Atom updated type.
Top Level OpenSearch properties
- itemsPerPage
Maps to the OpenSearch itemsPerPage property.
- query
Maps to the OpenSearch query property. This contains a searchTerms property, a role property and a startPage. All are optional.
{
"searchTerms": "foo",
"role": "request",
"startPage": 2
}
- startIndex
Maps to the OpenSearch startIndex property.
- startPage
Maps to the OpenSearch startPage property.
- totalResults
Maps to the OpenSearch totalResults property.
Common Types
- person
Maps to the Atom person and consists of a name, a uri and an email - any of these are optional.
{
"name": "foo",
"uri": "http://foo.bar",
"email": "foo@bar"
}
- category
Maps to the Atom category and consists of a term a schema and a label - term is required and others are optional.
{
"term": "foo",
"scheme": "http://example.org/categories/tags/holiday",
"label": "Holiday"
}
- link
Maps to the Atom link.
{
"href": "http://foo.bar/link",
"rel": "related",
"title": "Open Search link",
"type": "text/html"
}
- extension
This allows for extension objects that are not part of the open search defintions.
Note that the value may take any object instance that can be serialized to JSON.
{
"title": "custom",
"ns": "http://example.org/custom",
"value": { ... }
}
OpenSearch entry
Each entry in an OpenSearch result maps to an Atom entry class.
- author
Maps to the Atom author type and is an array of person instances.
- category
Maps to the Atom category type and is an array of category instances.
- content
Maps to the Atom content type.
- contributer
Maps to the Atom contributer type and is This is an array of person instances.
- extension
Maps to the Atom extensionElement and is an array of extension instances discussed below.
- id
Maps to the Atom id type.
- link
Maps to the Atom link type and is an array of link instances.
- published
Maps to the Atom published type.
- rights
Maps to the Atom rights type.
- source
Maps to the Atom source type.
- summary
Maps to the Atom summary type.
- title
Maps to the Atom title type.
- updated
Maps to the Atom updated type.