JSON to JSON transformation using JOLT -
input
{ "ances": [ { "id": 1, "level": "building", "name": " metro campus outdoor" }, { "id": 2, "level": "campus", "name": " metro campus" } ] }
expected output:
{ "result": [ { "building_id": 1, "building": "my building outdoor" }, { "building_id": 2, "campus": "man metro campus" } ] } want change name key value of level tag.
spec
[ { "operation": "shift", "spec": { "ances": { "*": { "id": "result[&1].building_id", "level": { "building": { // if matched way down here // go , grab "name" // , write it's value building in // result "@(2,name)": "result[&3].building" }, "campus": { "@(2,name)": "result[&3].campus" } } } } } } ] updated spec per comment, campus , building should not hard coded
[ { "operation": "shift", "spec": { "ances": { "*": { "id": "result[&1].building_id", "level": { "*": { // if matched way down here // go , grab "name" // , write it's value // result array, using value of // level key "@(2,name)": "result[&3].&1" } } } } } } ]
Comments
Post a Comment