I found myself with a json object structured as follows:
{
"sample1": {
"4": 2245,
"5": 2175,
"6": 3495,
"7": 1845,
...
"11.5": 1674,
"12.5": 1649
},
"sample2": {
"4": 3295,
"5": 3600,
"8": 2625,
"9": 2830,
...
"11.5": 2879,
"12.5": 3090
}
}
My goal is to convert it into the following format:
[
{
"index": "4",
"sample1": "2245",
"sample2": "3295"
},
{
"index": "5",
"sample1": "2175",
"sample2": "3600"
},
{
"index": "6",
"sample1": "3495",
"sample2": ""
},
....
{
"index": "12.5",
"sample1": "1649",
"sample2": "3090"
}
]
In my experience, achieving this in python using pandas is straightforward, but I'm hesitant to mix python scripts with javascript. Are there any simple alternatives to perform this task using Javascript?