
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2022 03:31 AM
Hi,
I would like to create the below outbound message from an incoming object array.
{
"root": {
"elementName": {
"@attributeName": "attributeValue",
"$": "elementValue"
},
"repeatedElement": [
{
"key": {
"@attr": "attr1",
"$": "key1"
},
"value": "value1"
},
{
"key": {
"@attr": "attr2",
"$": "key2"
},
"value": "value2"
}
]
}
}
Any suggestion please on the repeated elements, attributes, and values?
Thanks,
Deepak Shaw
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2022 05:36 AM
Done, check the pipeline and let me know if this works for you. Can be made with multiple mappers or a JSON Schema as well, but this is simpler in terms of snaps usage.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 02:44 AM
$InvoiceLines.map(x=>{"LineNumber":{"@LineExtAmtExclTax":x.LineExtAmtExclTax,"$":x.LineNumber},"value":x.Employee})
I’m glad I could help.
With the expression above, we’re mapping a specific value to every object inside the $InvoiceLines array. Basically the .map() function will iterate through the array, and for every object, it will map a JSON structure, using the values of that object.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 11:04 PM
Thanks @bojanvelevski
