I need to use value of a field to lookup another value in map.
{
"name": "Smith",
"Occupation": {
"Smith": "Engineer",
"John": "Plumber",
"Mary": "Doctor"
}
}
output:
{
"Name": "Smith",
"Job": "Engineer"
}
how to do this using jolt?
You can use such a single shift transformation :
[
{
"operation": "shift",
"spec": {
"name": {
"*": {
"@(2,Occupation.&)": "Job"
},
"@": "&"//replicates "name" itself
}
}
}
]
the demo on the site Jolt Transform Demo Using v0.1.1 is :