05-25-2023 04:01 AM
array mapping in mapper
My json:
“Employee”:
[
{
“name”: “Tom Cruise”,
“name”: “Robert Downey Jr.”
}
]
I need Output
{
“item”:
[
{
“name”: “Tom Cruise”,
“age”: 50,
},
{
“name”: “Robert Downey Jr.”,
“age”: 50,
}
]
}
Could you please help. Age is constant here.
Thanks
05-25-2023 04:56 AM
Hello @srini.polimera,
You can try with Mapper and with the following expression.
$Employee.map(x => x.extend({"age":50}))
I suppose that you have employees as separate objects in the array, and not as you have them here in the input.
Let me know if this helps you.
BR,
Aleksandar.