microformats2-json

From Microformats Wiki
Revision as of 19:37, 21 April 2018 by Zegnat (talk | contribs) (First draft of page structure.)
Jump to navigation Jump to search

This article is a stub. You can help the microformats.org wiki by expanding it.

microformats2 JSON is the canonical output format of the microformats2 parsing algorithm. As such it can be used to compare parsers and create test suites. It is also used as the official serialisation format of microformats objects, and relied upon by specifications such as Micropub.

⚠️ The JSON format used is not pinned to a specific JSON specification. See issue #23 for a discussion on the subject.

Parsed Document Format

Parsers collect not only microformats2 objects, but also link relationships. Parsing an entire document will result in an outer object with 3 properties: items, rels, and rel-urls:

{
  "items": [],
  "rels": {},
  "rel-urls": {}
}
  1. items is an array of microformats2 objects, ordered according to their order in the source document.
  2. rels is an object where the member names reflect all rel-values found in the source document.
  3. rel-urls is an object where the member names reflect all URLs found in the source document with rel-values attached.

microformat2 Objects

{ 
  "type": [],
  "properties": {},
  "children": []
}
  1. type is an array of the types that identify the microformat, ordered alphabetically.
  2. properties is an object where the member names reflect all properties found for the microformat.
  3. The optional member children is an array of other microformats2 objects that were found nested in the current one.

type

properties

children

rels Object

rel-urls Object