JSON.ARRTRIM

Since 1.1.0JSON

Syntax

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

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\"]]"