Contact Free trial Login


unzip(Array<Array<T>>): Array<Array<T>>

Performs the opposite of zip.

Given a single array where each index contains an array with two elements, unzip outputs two separate arrays, each with the corresponding elements of each pair. If the indices in the provided array contain arrays with more than two elements, the output contains as many arrays as there are elements for each index.


This example unzips an array of arrays. Note that in example b, the number of elements in input array is not consistent. So the function only creates as many full arrays as it can, in this case just one.


%dw 2.0
output application/json
  "a" : unzip([[0,"a"],[1,"b"],[2,"c"],[3,"d"]]),
  "b" : unzip([ [0,"a"], [1,"a","foo"], [2], [3,"a"]])


      [0, 1, 2, 3],
      ["a", "b", "c", "d"]
  "b": [

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub