cancel
Showing results for 
Search instead for 
Did you mean: 

Map input array issue

srini_polimera
New Contributor III

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

1 REPLY 1

Aleksandar_A
Contributor III

Hello @srini.polimera,

You can try with Mapper and with the following expression.
image

$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.