How to parse data from Zoho Analytics API

Zoho Analytics returns tabular datasets in the form of JSONs where column names are provided separately in an array, and table values are stored in a jagged array (array of arrays). Here is an example:

{
   "response":{
      "uri":"\/api\/user@corp.com\/CDData\/Suppliers",
      "action":"EXPORT",
      "result":{
         "column_order":["AAA","BBB","CCC"],
         "rows":[
            [ "0", "10","XXX"],
            [ "1", "20","YYY" ],
            ["2","30","ZZZ"]
         ]
      }
   }
}

Parsing such a structure may look challenging, however it’s doable with EasyMorph.

The idea is to make data suitable for pivoting, then pivot it. Column labels are pivoted separately to produce a table with the correct order of columns to which the main dataset is later appended.

With this approach it is possible to produce a tabular dataset from JSON without hardcoding column names or JSON paths.

See example below:
parse-json-zoho-analytics.morph (7.1 KB)
json.txt (262 Bytes)