Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 1.02 KB

json.objlen.md

File metadata and controls

42 lines (26 loc) · 1.02 KB

Report the number of keys in the JSON object at path in key

Examples

Required arguments

key

is key to parse. Returns null for nonexistent keys.

Optional arguments

path

is JSONPath to specify. Default is root $. Returns null for nonexistant path.

Return

JSON.OBJLEN returns an array of integer replies for each path specified as the number of keys in the object or nil, if the matching JSON value is not an object. For more information about replies, see Redis serialization protocol specification.

Examples

{{< highlight bash >}} redis> JSON.SET doc $ '{"a":[3], "nested": {"a": {"b":2, "c": 1}}}' OK redis> JSON.OBJLEN doc $..a

  1. (nil)
  2. (integer) 2 {{< / highlight >}}

See also

JSON.ARRINDEX | JSON.ARRINSERT

Related topics