Skip to content

#zip

Combines two arrays pairwise using a two-parameter lambda.

#zip(first, second, @x;@y: combine)
Category Arrays and sequencesValid in Property value
Name Type Description
first path | array The first array.
second path | array The second array.
combine lambda Receives one element from each array and returns the combined value.

array

source.json
{
"numbers": [ 1, 2 ],
"letters": [ "a", "b" ]
}
transformer.json
{
"result": "#zip($.numbers, $.letters, @x;@y: { 'first': @x, 'second': @y })"
}
output.json
{
"result": [ { "first": 1, "second": "a" }, { "first": 2, "second": "b" } ]
}

Try it in the playground →

#reduce · #select