# JSON.TOGGLE Toggle a Boolean value stored at `path` [Examples](#examples) ## Required arguments
key is key to modify.
## Optional arguments
path is JSONPath to specify. Default is root `$`.
## Return JSON.TOGGLE returns an array of integer replies for each path, the new value (`0` if `false` or `1` if `true`), or `nil` for JSON values matching the path that are not Boolean. For more information about replies, see [Redis serialization protocol specification](https://redis.io/docs/latest/develop/reference/protocol-spec). ## Examples
Toggle a Boolean value stored at path Create a JSON document. redis> JSON.SET doc $ '{"bool": true}' OK Toggle the Boolean value. redis> JSON.TOGGLE doc $.bool 1) (integer) 0 Get the updated document. redis> JSON.GET doc $ "[{\"bool\":false}]" Toggle the Boolean value. redis> JSON.TOGGLE doc $.bool 1) (integer) 1 Get the updated document. redis> JSON.GET doc $ "[{\"bool\":true}]"
## See also [`JSON.SET`](https://redis.io/docs/latestcommands/json.set/) | [`JSON.GET`](https://redis.io/docs/latestcommands/json.get/) ## Related topics * [RedisJSON](https://redis.io/docs/latest/develop/data-types/json/) * [Index and search JSON documents](https://redis.io/docs/latest/develop/interact/search-and-query/indexing/)