It is possible to make this kind of Json Transformation using JOLT or other java api, and get the mapping result after transformation
Example
update all persons ( name and parent ) from Paul to 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
mapping ( 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].&"
}
}
}
}
]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.