← 输入框|github.com|刷新
Skip to content

Discrepancy between documented behavior and actual behavior for JSON.OBJKEYS for nonexistent keys #1531

Open

Description

@JeanSamGirard

There is a discrepancy between the documented behavior and actual behavior for JSON.OBJKEYS for nonexistent keys

Documented behavior : Returns null for nonexistent keys.

Observed behavior : ERR could not perform this operation on a key that doesn't exist

Note that with .-based path argument the command returns null as expected.

To align with the behavior of GET and JSON.GET the documented behavior makes more sense in my opinion.

Activity

  1. LiorKogan commented on Apr 2, 2026

    @LiorKogan
    Contributor

    Thank you.
    The documentation indeed states that null is returned for nonexistent key.
    This is true for .-paths but not for $-paths.

    redis> JSON.OBJKEYS no_such_key .
    (nil)
    redis> JSON.OBJKEYS no_such_key $
    (error) ERR could not perform this operation on a key that doesn't exist
    

    We will update the documentation accordingly.

    This behavior is consistent with other commands, such as JSON.ARRLEN.

    For JSON.GET the reply is (nil) whether the path is a .-path or a $-path.

    We cannot solve this inconsistency now without introducing a breaking change.

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