JSON.CLEAR

Since 1.1.0JSON

Syntax

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

Empties each array and object path matches, and sets each number it matches to 0.

Reply

  • The number of values changed.

Examples

> JSON.SET d $ '{"tags":["a","b"]}'
OK
> JSON.CLEAR d $.tags
(integer) 1
> JSON.GET d $.tags
"[[]]"