Forum Discussion
tstack
9 years agoFormer Employee
The “extend()” method on objects can be used to construct new objects in various ways. For this case, you can create a list of key/value pairs and then extend an existing to create a new object. The pairs can be created using the ‘map()’ method on arrays to iterate over each element and construct the pair. Altogether, it would look like this:
{id: $id}.extend($.custom_fields.map(elem => [elem.id, elem.value]))
That should take care of transforming each element in the result array. You can then use the ‘Mapping Root’ feature in the mapper to transform each element in the ‘results’ array. Here is the Mapper configuration that should work: