Dataweave 2: Objects and Arrays

Anybody dealing with Dataweave scripts will often come across situations where an Object needs to be converted into an Array or vice-versa. The Dataweave 2 examples below describe how to convert between Objects and Arrays.

Example 1: Converting an Object to an Array

This example uses the core Dataweave function pluck; it is useful in mapping an object into an array, pluck iterates over an object and returns an array of keys, values, or indices from the object. It is an alternative to mapObject, which is similar but returns an object, instead of an array.