Convert array of objects in an object of key value pairs
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 01:45 PM
Hello,
I need to convert the following array of object into an object of key value pairs.
Input:
Expected output:
Thank you for your help!
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 01:28 AM - edited 01-25-2024 01:28 AM
Hi @Max ,
You can try the reduce function in the mapper snap. You'll need to set {} (an empty object) as the initialElement and apply the extend function to put all array elements into the initialized empty object.
$ranges.reduce((accum, currentValue) => accum.extend(currentValue), {})
Hope this helps!
BR.
