Looking to convert an array of JSON objects into a format where rows become columns and the values at the side become column values, similar to the crosstab function in PostgreSQL.
The JSON data looks something like this:
{"marketcode":"01","size":"8,5","amount":1},
{"marketcode":"01","size":"9","amount":1},
{"marketcode":"01","size":"10","amount":0},
I need it to be transformed into this structure:
{"marketcode": "01", "8,5": 1, "9": 1, "10": 0}
I've tried searching for a solution using Lodash, but haven't had any success so far.