我需要转换这个json数组:
[
{
"timestamp": "2025-01-19T17:00:00Z",
"absoluteDeviationsX": [10, 11, 12 ]
},
{
"timestamp": "2025-01-20T17:00:00Z",
"absoluteDeviationsX": [20, 21, 22 ]
]
}
]
至:
[
{
"timestamp": "2025-01-19T17:00:00Z",
"absoluteDeviationsX0": 10,
"absoluteDeviationsX1": 11,
"absoluteDeviationsX2": 12,
},
{
"timestamp": "2025-01-20T17:00:00Z",
"absoluteDeviationsX0": 20,
"absoluteDeviationsX1": 21,
"absoluteDeviationsX2": 22,
}
]
使用 JSONata。
我需要这个来处理 Grafana 的 Infinity 插件中的数据。
$.$merge([
{ "timestamp": timestamp },
absoluteDeviationsX#$i{
"absoluteDeviationsX" & $i: $
}
])