我正在尝试构建一个来自的震动变压器
{
"name": "name",
"tags": [
"value1",
"value2"
]
}
(对于n个值)为
{
"options": [
{
"key": "value1",
"value": "value1"
},
{
"key": "value2",
"value": "value2"
}
]
}
我已经尝试了很多变体,可以将输入数组的项目移到输出的各个部分,但是我不知道如何将数组项目的值复制到输出的对象中。
内联说明:
[
{
"operation": "shift",
"spec": {
//match tags
"tags": {
//for each item in array
"*": {
//Use value from the array (@) and set it as key and value
//Using array position in [&1]
"@": ["options.[&1].key", "options.[&1].value"]
}
}
}
}
]