would like to transform a row-based JSON in a column-based JSON. I receive the JSON in a row-based form and will do some visualization with it, which would be easier in a column-based form.
row-based would look something like this:
{
"0": {
"fname": "John",
"lname": "Miller",
"age": 50
},
"1": {
"fname": "Eve",
"lname": "Johnson",
"age": 40
}...
Example column-based:
{
"fname": {
"0" : "John",
"1" : "Eve"
},
"lname": {
"0" : "Miller",
"1" : "Johnson"
},
"age": {
"0": 50,
"1" : 40
}...
Is there a more efficient way than just looping through all elements and rewriting the JSON completely with python?
Thanks!