[英]Custom JOLT Transformation with Mapping
It is possible to make this kind of Json Transformation using JOLT or other java api, and get the mapping result after transformation 可以使用JOLT或其他Java API进行这种Json转换,并在转换后获取映射结果
Example 例
update all persons ( name and parent ) from Paul to Evan 更新所有从Paul到Evan的人员(姓名和父母)
Input 输入
{
"persons":[
{
"name":"Paul",
"adress":"abcd",
"parent":"Chris"
},
{
"name":"Jean",
"adress":"abcd",
"parent":"Paul"
}
]
}
output 产量
{
"persons":[
{
"name":"Evan",
"adress":"abcd",
"parent":"Chris"
},
{
"name":"Jean",
"adress":"abcd",
"parent":"Evan"
}
]
}
Can someone help to write the spec of this Transformation, and how we can get the mapping result after Transformation 有人可以帮忙编写此Transformation的规范吗,以及在Transformation之后我们如何获得映射结果
mapping ( Paul -> Evan ) 映射(Paul-> Evan)
One way to accomplish this is using this spec: 实现此目的的一种方法是使用以下规范:
[
{
"operation": "shift",
"spec": {
"persons": {
"*": {
"name": {
"Paul": {
"#Evan": "persons.[&3].name"
},
"*": {
"@(2,name)": "persons.[&3].name"
}
},
"parent": {
"Paul": {
"#Evan": "persons.[&3].parent"
},
"*": {
"@(2,parent)": "persons.[&3].parent"
}
},
"*": "persons.[&1].&"
}
}
}
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.