Skip to content

#slice

Returns the part of an array that falls within the provided range.

#slice(array, range)
Category Arrays and sequencesValid in Property value
Name Type Description
array path | array The source array.
range range A range such as 2..4, ..3 or ^3...

array

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

Try it in the playground →

#substring · #take · #skip