JSON.ARRPOP

Since 1.1.0JSON

Syntax

JSON.ARRPOP key [path [index]]
  • Flags: write
  • ACL categories: @json, @slow, @write
  • Arity: -2

Removes and returns an element from each array path matches: the last one, or the one at index. An index out of range takes the nearest end.

Reply

  • The elements removed, as JSON text.

Examples

> JSON.SET d $ '{"tags":["first","math","code"]}'
OK
> JSON.ARRPOP d $.tags
1) "\"code\""
> JSON.ARRPOP d $.tags 0
1) "\"first\""