Hey there, in my code I retrieve a JSON blob that has the following structure:
[
{
"ts": 1431736740,
"aggs": {
"DNS": {
"min": 20,
"max": 21,
},
"SEND": {
"min": 102,
"max": 8114,
},
"SSL": {
"min": 110,
"max": 7806,
},
"SERVERBUSY": {
"min": 1360,
"max": 13709,
}
}
},
{
"ts": 1431736680,
"aggs": {
"DNS": {
"min": 22,
"max": 24,
},
"SEND": {
"min": 210,
"max": 8251,
},
"SSL": {
"min": 117,
"max": 12488,
},
"SERVERBUSY": {
"mn": 6462,
"max": 9800,
}
}
},
{
"ts": 1431736620,
"aggs": {
"DNS": {
"min": 21,
"max": 22,
},
"SEND": {
"min": 92,
"max": 12035,
},
"SSL": {
"min": 111,
"max": 9758,
},
"SERVERBUSY": {
"min": 9855,
"max": 14112,
}
}
}
]
I am seeking assistance to transform it into a format that resembles this:
[
{
"key": "DNS",
"values": [
[
0, //Starting from zero and incremented by one.
20 //Value extracted from aggs.DNS.min
],
[
1,
22
],
[
2,
21
]
]
},
{
"key": "SEND",
"values": [
[
0,
102
],
[
1,
210
],
[
2,
92
]
]
},
{
"key": "SSL",
"values": [
[
0,
110
],
[
1,
117
],
[
2,
111
]
]
},
{
"key": "SERVERBUSY",
"values": [
[
0,
1360
],
[
1,
6462
],
[
2,
9855
]
]
}
]
I'm using a specific library that only works with JSON data structured in this particular way. Do you think it's possible to achieve this conversion? I've come across solutions for altering JSON formats, but I'm unsure if such a significant modification is feasible. Any insights or guidance would be highly appreciated!