cancel
Showing results for 
Search instead for 
Did you mean: 

Get each value from an array and create for each a record

JensDeveloper
Contributor II

HI experts,

I have this input and the array of EmailAdresses can consist of 1 - 5 addresses:
[
{
“BusinessPartner”:“10”,
“LastName”:“lam”,
“SearchTerm1”:“lam”,
“to_BusinessPartnerAddress”:{
“results”:[
{
“BusinessPartner”:“10”,
“Country”:“DE”,
“to_EmailAddress”:{
“results”:[
{
“EmailAddress”:[
info@gmail.com”,
test@gmail.com
]
}
]
}
}
]
}
}
]

I want to accomplish this (get all the values from the array and put them below each other as strings):
[
{
“BusinessPartner”: “10”,
“LastName”: “testlastname”,
“SearchTerm1”: “lam”,
“to_BusinessPartnerAddress”: {
“results”: [
{
“BusinessPartner”: “10”,
“Country”: “DE”,
“to_EmailAddress”: {
“results”: [
{
“EmailAddress”: “info@gmail.com
},
{
“EmailAddress”: “test@gmail.com
}
]
}
}
]
}
}
]

How can I accompllish this I already tried to change it to an object, but I think it’s something with mapping.

Regards

Jens

1 ACCEPTED SOLUTION

Aleksandar_A
Contributor III

Hi @JensDeveloper,

You can try by using Mapper Snap with the following settings:
image

Expression used:

jsonPath($, "$EmailAddress[*]").map(x => {"EmailAddress":x})

Let me know if this helps.

BR,
Aleksandar.

View solution in original post

1 REPLY 1

Aleksandar_A
Contributor III

Hi @JensDeveloper,

You can try by using Mapper Snap with the following settings:
image

Expression used:

jsonPath($, "$EmailAddress[*]").map(x => {"EmailAddress":x})

Let me know if this helps.

BR,
Aleksandar.