cancel
Showing results for 
Search instead for 
Did you mean: 

Map Key value pairs function

JensDeveloper
Contributor II

Hi,

I’m having it very difficult to fill the value of a key/value pair wit another value.
I Have an object that consists of a list of strings that are each unique. but with each string inside the object there is a value outside the object for each item in the list (The Value). The goal is to put for every item in the list of the object to change the value of a,b,c to the value of the key “Value1”, “Value2” See below
Before
[
{
“Name” : {
“a” : “a”
},
“Value1” : “randomvalue”
},
{
“Name” : {
“b” : “b”
},
“Value2” : “randomValue”
}
]

After
[
{
“Name” : {
“a” : “randomvalue of Value1”
},
“Value1” : “randomvalue”
},
{
“Name” : {
“b” : “randomvalue of Value2”
},
“Value2” : “randomValue”
}
]

If there is anything that’s not understandable, let me know. Thanks in advance.

1 ACCEPTED SOLUTION

AleksandarAngel
Contributor III

Hi @JensDeveloper,

Please try with the following expression in a Mapper snap and let me know if it helps you
$Name.mapValues(x=>$.entries()[1][1])

BR Aleksandar.

View solution in original post

2 REPLIES 2

AleksandarAngel
Contributor III

Hi @JensDeveloper,

Please try with the following expression in a Mapper snap and let me know if it helps you
$Name.mapValues(x=>$.entries()[1][1])

BR Aleksandar.

YES it works, wow!
Sorry but I was struggling a lot with language expressions and functions so I am Relieved. Thank you. I still need to learn a lot but I love it!