JSON.TOGGLE

Since 1.1.0JSON

Syntax

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

Flips each boolean path matches.

Reply

  • A JSONPath: the new values as 1 and 0. A legacy path: "true" or "false".

Examples

> JSON.SET d $ '{"active":true}'
OK
> JSON.TOGGLE d $.active
1) (integer) 0
> JSON.TOGGLE d .active
"true"