【发布时间】:2019-02-15 16:14:28
【问题描述】:
我正在尝试对来自以下 JSON 的值进行条件映射。
我的意见,
{
"rating": [
{
"id": 1,
"locations": [
{
"num": 1
},
{
"num": 2
}
]
}
]
}
预期输出:
{
"rating": [
{
"id": 1,
"locations": [
{
"num": 1
}
],
"new_locations": [
{
"num": 2
}
]
}
]
}
我的规格,
[
{
"operation": "shift",
"spec": {
"rating": {
"*": {
"locations": {
"*": {
"num": "@(3,id)"
}
}
}
}
}
}
]
如果 num 值与 id 匹配,那么它应该留在位置数组中,否则应该移动到 new_locations。
谁能给我建议。谢谢。
【问题讨论】:
标签: transformation jolt