Skip to content

json append #23

@goodluckwgw

Description

@goodluckwgw

String json = "{"setting":{"profit_ report":{"profit_ report_ tb":{"__ meta":{"text":"abc"}}}}}";

Want to append a property check:true , how to write the set method

Activity

gkorland

gkorland commented on Apr 25, 2021

@gkorland
Contributor

@goodluckwgw I'm not sure I'm getting the issue, can you please extend?

oshadmi

oshadmi commented on May 24, 2021

@oshadmi

@goodluckwgw
You can append a key in a specific path using json.set, for example:
For

> json.set doc:1 $ '{"setting":{"profit_report":{"profit_report_tb":{"__meta":{"text":"abc"}}}}}'
OK

You can add check:true

> json.set doc:1 $.setting.profit_report.profit_report_tb.__meta.check 'true'
OK

And get the key check as a sibling of key text

> json.get doc:1 $
"{\"setting\":{\"profit_report\":{\"profit_report_tb\":{\"__meta\":{\"text\":\"abc\",\"check\":true}}}}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gkorland@goodluckwgw@oshadmi

        Issue actions

          json append · Issue #23 · RedisJSON/JRedisJSON