cancel
Showing results for 
Search instead for 
Did you mean: 

How To Rename Array key or Column

sjakathi
New Contributor II

Hi ,

I have an array and I want to change the key/column names of it.
{
“Items”:{
“Item”:[
{
“Item”:'“Pen”,
“Desc”:“Black”
},
{
“Item”:"Pen ",
“Desc”:“Blue”
}
]
}

i want to rename the Item as WM_Item and Desc as WM_Desc

3 REPLIES 3

SpiroTaleski
Valued Contributor

Hi @sjakathi

Please check the attached sample pipeline:

SL_Community_2021_02_02.slp (3.6 KB)

Hope this will help.

Regards,
Spiro Taleski

cjhoward18
Employee
Employee

This expression in a Mapper snap:
$Items.Item.map(value => value.mapKeys((value, key) => "WM_" + key))

will add the ‘WM_’ prefix to the keys for each item in this Item list.

Having it mapped to the target Items.Item will replace the old value with your desired output.

sjakathi
New Contributor II

Thanks you all for the reply it worked…