Open HarithaKoritala opened 1 year ago
Hi @HarithaKoritala
You can use the below spec
[
{
"operation": "shift",
"spec": {
"employees": {
"*": {
"salary": {
"*y*": {
"@1": "&4.employee&(0,2)"
}
}
}
}
}
}
]
hello i am curious on the spec can u explain these 2 "y : { "@1": "&4.employee&(0,2)"
I have input like below { "employees": [ {"name":"", "salary":"salary1"}, {"name":"emp2", "salary":"salary2"}, {"name":"empn","salary":"salaryn"} ] } this need to be transformed like { "employees": { "employee1":"salary1", "employee2":"salalry2","employeen":"salaryn"} }
I tried the below jolt spec to transform but index is started from 0 index instead of 1
{ "operation":"shift", "spec":{ "employees":{ "*": { "salary":"employees.employee&1"} }} }
This gave result like { "employees": { "employee0":"salary1", "employee1":"salalry2","employeen":"salaryn" } }
How can i manage to produce the result in proper way , Can anyone please help me with this...