Skip to content

json append #23

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

Open
goodluckwgw opened this issue Jun 17, 2020 · 2 comments
Open

json append #23

goodluckwgw opened this issue Jun 17, 2020 · 2 comments

Comments

@goodluckwgw
Copy link

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

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

@gkorland
Copy link
Contributor

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

@oshadmi
Copy link

oshadmi commented May 24, 2021

@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
Projects
None yet
Development

No branches or pull requests

3 participants