Say I have a JSON like the structure bellow
[{
"name": "name1",
"custitem_color": "3",
"custitem_ribbon": "1",
"baseprice": "10.00",
"cost": "12.00"
}, {
"name": "name2",
"custitem_color": "4",
"custitem_ribbon": "2",
"baseprice": "20.00",
"cost": "15.00"
}, {
"name": "name3",
"custitem_color": "6",
"custitem_ribbon": "3",
"baseprice": "30.00",
"cost": "22.00"
}, {
"name": "name4",
"custitem_color": "8",
"custitem_ribbon": "4",
"baseprice": "40.00",
"cost": "18.00"
}]
I want to generate the output as bellow
"name": ["name1","name2","name3"],
"custitem_color":["3","4","6","8"]
I searched over SO but didn't get a match of this type. I'm curious to know if is there any library or workaround to get all the key's value as a separate array like the above I've mentioned. Any suggestions or point to any resource would be greatly appreciated.