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

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