我有一个JSON源代码如下:
{
"name": "test",
"age" 10,
"city": null,
"pinCode": "400081",
"address": {
"buildingNo": "B-301"
}
}
如果city是100,则更新address到null
,例如:
"person" : {
"name" : "test",
"age" : 10,
"address" : null
}
否则,如果city是100,则保持如下结果:
{
"person" : {
"name" : "test",
"age" : 10,
"address" : {
"pinCode" : "400081",
"buildingNo" : "B-301"
}
}
}
我试过像下面这样的jolt transform:
[
{
"operation": "shift",
"spec": {
"name": "person.name",
"age": "person.age",
"city": {
"null": {
"@(1,person.address)": null
},
"*": {
"@1": "person.address.city"
}
},
"pinCode": "person.address.pinCode",
"address": {
"buildingNo": "person.address.buildingNo"
}
}
}
]