JRedisJSON icon indicating copy to clipboard operation
JRedisJSON copied to clipboard

json append

Open goodluckwgw opened this issue 4 years ago • 2 comments

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

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

goodluckwgw avatar Jun 17 '20 05:06 goodluckwgw

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

gkorland avatar Apr 25 '21 08:04 gkorland

@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}}}}}"

oshadmi avatar May 24 '21 11:05 oshadmi