JSON.ARRTRIM

Since 1.1.0JSONChanged in 1.2.1

Syntax

JSON.ARRTRIM key path start stop
  • Flags: write
  • ACL categories: @json, @slow, @write
  • Arity: 5

History

  • 1.2.1: arity: -2 -> 5

Keeps only the elements from start to stop, both included, in each array path matches.

Reply

  • The new lengths.

Examples

> JSON.SET d $ '{"tags":["a","b","c","d"]}'
OK
> JSON.ARRTRIM d $.tags 0 1
1) (integer) 2
> JSON.GET d $.tags
"[[\"a\",\"b\"]]"