JSON

The JSON support in orcus covers three distinct use cases.

The first is document parsing, where you want to load a JSON string into memory and traverse its contents. The high-level document_tree class handles this: call its load() method to populate the tree, then navigate it via get_document_root(). For cases where you already have your own data structure to populate, the low-level json_parser class lets you supply a handler that receives parser callbacks directly. document_tree itself is built on top of json_parser.

The second is subtree extraction, where you want to isolate a portion of a larger JSON document using a JSONPath expression. subtree supports this by taking a document and a path expression and exposing the selected subtree for further inspection or serialisation.

The third is spreadsheet mapping, where you want to project the contents of a JSON document onto a spreadsheet by declaring how repeating structures map to rows and columns. orcus_json provides this capability, either through a programmatic API where you register paths and ranges by hand, or through automatic structure detection that infers the mapping from the document itself.

Parsing

Subtree extraction

JSON mapping