Serialization (JSON)

Specification
This guide applies for result printers compatible with and later.

Printrequests
The printrequests array will contain:
 * label -> string for labeling results, contains no markup
 * typeid -> id of the datatype of the printed objects, if applicable
 * mode -> type of print request
 * format -> output format string for formatting results, if applicable

Results
The results array will contain:
 * subject (like File:Foo.jpg)
 * printouts specifed by
 * printrequests label (queried property)
 * printrequests value
 * fulltext -> subject fulltext name
 * fullurl -> subject url
 * namespace -> subject namespace number
 * exists -> boolean if the subject exists (red vs. blue link)

Meta
Meta array is only relevant for the SMW API, the will only export the count number of the related query.
 * hash -> md5 hash key of the result array (mostly used for comparison on the client side via JS etc.)
 * count -> count of the results arrays
 * offset -> set by the query (count + offset result in total of available results)

JavaScript and SMW JSON serialization
Currently available result printers that use the SMW API and result serialization are DataTables class and EventCalendar class

The "smw.Data.factory" (normally is only called during smw.Api.parse/fetch) will map result objects that were serialized by the SMW\DISerializer and generate type hinting objects simialar to the dataitems/datavalues in PHP. TypeId is used as reference map to assign each of its objects to a corresponding a smw.dataItem/smw.dataValue object.


 * '_wpg' -> smw.dataItem.wikiPage
 * '_uri' -> smw.dataItem.uri
 * '_dat' -> smw.dataItem.time
 * smw.dataItem.property

* Structure is similar to * * Subject (if exists is of type smw.dataItem.wikiPage otherwise a simple object) * |--> property -> smw.dataItem.property *        |--> smw.dataItem.wikiPage *        |--> ... * |--> property -> smw.dataItem.property *        |--> smw.dataItem.uri *        |--> ... * |--> property -> smw.dataItem.property *        |--> smw.dataItem.time *        |--> ...

Parse serialized objects
This is an example and only should give a glipmse in "how easy" it is to parse SMW typed objects in JS.