Simplifying Google Sheet JSON using Jolt -
i have gone through of test cases in jolt seem serve examples, cannot find looking for. background, source code stripped version of comes google sheet. rows , columns.
source json:
[   {     "values": [       {         "formattedvalue": "achme - thailand"       },       {         "formattedvalue": "5,368.11"       },       {         "formattedvalue": "17.09%"       }     ]   },   {     "values": [       {         "formattedvalue": "achme-b2a"       },       {         "formattedvalue": "101.47"       },       {         "formattedvalue": "0.32%"       }     ]   },   {     "values": [       {         "formattedvalue": "achme-b2e"       },       {         "formattedvalue": "83.79"       },       {         "formattedvalue": "0.27%"       }     ]   } ] desired output:
[   {    "row": [      "achme - thailand",      "5,368.11",      "17.09%"    ]   },   {     "row": [       "achme-b2a",       "101.47",       "0.32%"     ]   },   {     "row": [       "achme-b2e",       "83.79"       "0.27%"     ]   } ] i have tried jolt gets me of way there, still losing row boundaries. comes out 1 'row' element , of values in array.
[   {     "operation": "shift",     "spec": {       "*": {         "values": {           "*": {             "formattedvalue": "row[]"           }         }       }     }   } ] 
spec
[   {     "operation": "shift",     "spec": {       "*": { // row index         "values": {           "*": { // column index             "formattedvalue": "[&3].row[&1]"           }         }       }     }   } ] note, assumes incoming "values" arrays same length.
wiki
Comments
Post a Comment