Skip to content

JSON.ARRLEN behaviour doesn't match documentation, with defaults #502

Closed

Description

@chayim

Based on the documentation for JSON.ARRLEN if the path isn't provided '.' is assumed. Similarly if a key is not provided, a null should be returned:

path defaults to root if not provided. If the key or path do not exist, null is returned.

But, using our example below, when testing with a key that does not exist an error is raised, instead of None.

127.0.0.1:36379> json.arrlen 'smirf'
(error) ERR wrong number of arguments for 'json.arrlen' command
127.0.0.1:36379> json.arrlen 'smirf' .
(nil)
127.0.0.1:36379> json.arrlen 'smirf' 
(error) ERR wrong number of arguments for 'json.arrlen' command
127.0.0.1:36379> 

In our second example - when setting a value, and attempting to run an arrlen without specifying a path, the default path of '.' should be used. But as seen below, it was not.

127.0.0.1:36379> json.set foo . '[5,6,7,8,9]'
OK
127.0.0.1:36379> json.arrlen foo
(error) ERR wrong number of arguments for 'json.arrlen' command
127.0.0.1:36379> json.arrlen foo .
(integer) 5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions