Transformation - I need to remove an array inside an object-flatten
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 04:15 AM - edited ‎01-10-2024 04:16 AM
In Mulesoft there is a function called "flatten". Is there something similar in SL ?
My problem is described in the pic below. I need to remove bsn array and bring its child objects into the products.
I was able to split the bsn into a new array. Now how do I remove bsn from the original object? and merge them to accomplish my goal as shown in pic 1 ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 01:37 PM
@aakumar - for simplicity I would solve this with 2 Mapper snaps. The first, configure as follows:
Note the use of Passthrough and the Mapping Root so we can work within the products array. Then we're using the Object.merge() method to pull the elements from the "bsn" array into the "products" array objects.
The second Mapper configured as below simply drops the "bsn" array from the products array.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2024 11:40 AM
@aakumar You can also use use the AutoPrep Snap to flatten the incoming data hierarchy.. https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/2568781882/AutoPrep?src=search
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2024 10:36 AM
dbapat, how about an example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2024 10:37 AM
@ Ruth Stento.
