Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON.SET fails to update a member whose name contains slash #31

Open
joehu21 opened this issue Feb 10, 2025 · 0 comments
Open

JSON.SET fails to update a member whose name contains slash #31

joehu21 opened this issue Feb 10, 2025 · 0 comments
Assignees

Comments

@joehu21
Copy link
Collaborator

joehu21 commented Feb 10, 2025

If a json property name contains slash, json.set fails to update the value. The bug likely applies to all json write commands. Fortunately, there's a workaround.

Repro

    127.0.0.1:6379> json.set k1 . '{"a": 4.5, "b/c": 85.0}'
    OK
    127.0.0.1:6379> json.set k1 $.'b/c' 0
    OK
    127.0.0.1:6379> json.get k1
    "{\"a\":4.5,\"b/c\":85.0,\"b\":{\"c\":0}}"

Workaround

When updating a member name that contains slash, escaped the slash using ~1:

    127.0.0.1:6379> json.set k1 . '{"a": 4.5, "b/c": 85.0}'
    OK
    127.0.0.1:6379> json.set k1 $.'b~1c' 0
    OK
    127.0.0.1:6379> json.get k1
    "{\"a\":4.5,\"b/c\":0}"
@joehu21 joehu21 self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant