Forum Discussion

vaidyarm's avatar
vaidyarm
Contributor
6 years ago

How to approach when we have array of data to be distributed as key value paired array

Hi,

I am running lot of iterations, but not able to find the solution for below case :

Case :

Input is an array like below :
{ "olditem": [ { "id": "1" }, { "id": "2" }, { "id": "3" }, { "id": "4" }, { "id": "5" } ] }

This need to be mapped to output payload which has array with id keys as below
"{ "batch": [ { "row": "1" }, { "row": "2" }, { "row": "3" }, { "row": "4" }, { "row": "5" } ] }

Note : this elements can be at any hierarchy in the JSON payload. also id counts is dynamic