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

How should I update the key if there are dots and slashes in the key? #78

Open
echo567 opened this issue Mar 2, 2024 · 1 comment
Open

Comments

@echo567
Copy link

echo567 commented Mar 2, 2024

example:
{ "name": "test", "address": { "a.b.c/d": "off", "asd": "asd" } }
image
I want to change the value of a.b.c/d to abc
How should it be achieved?
thanks

@harrisonhjones
Copy link

You can use \\ to escape them. eg:

value, err = sjson.Set(value, "address.a\\.b\\.c\\/d", "some value")

Haven't tested escaping a / before though so you might have to tweak it.

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

2 participants