I want to split the array inside the JSON, into multiple rows via JOLT. Here number of values inside the array can be varied.
Input JSON:
[
{
"stationname": "station green",
"data": [
{
"key": "X2-P1",
"value": [
0.453,
6.453
]
},
{
"key": "X1-P1",
"value": [
27,
56
]
},
{
"key": "weight",
"value": [
7.0261,
3.5463
]
}
]
}
]
Output JSON:
[ { "stationname": "station green", "Date": "2024-06-16T19:02:16", "data": [ { "key": "X2-P1", "value": 0.453 }, { "key": "X1-P1", "value": 27 }, { "key": "weight", "value": 7.0261 } ] }, { "stationname": "station green", "Date": "2024-06-17T19:32:13", "data": [ { "key": "X2-P1", "value": 6.453 }, { "key": "X1-P1", "value": 56 }, { "key": "weight", "value": 3.5463 } ] } ]
And if there is any reading without below format then I want to eliminate them with out dividing into multiple lines.
e.g.:
[
{
"stationname" : "workstation syn"
}] // here no array values
[{
"Date" : "2024-32-16T19:02:16",
"data" : [ {
"key" : "X2-P1",
"value" : 3.465
}, {
"key" : "X1-P1",
"value" : 22
}, {
"key" : "weight",
"value" : 4.4312
} ]
}]//here, no station name
Thank you.