Skip to content

#take

Returns the leading elements of an array, up to the specified count.

#take(array, count)
Category Arrays and sequencesValid in Property value
Name Type Description
array path | array The source array.
count integer How many elements to take.

array

source.json
{
"numbers": [ 1, 2, 3, 4 ]
}
transformer.json
{
"result": "#take($.numbers, 2)"
}
output.json
{
"result": [ 1, 2 ]
}

Try it in the playground →

#skip · #takeWhile · #slice