JRedisJSON
JRedisJSON copied to clipboard
json append
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 I'm not sure I'm getting the issue, can you please extend?
@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}}}}}"