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

Escape JSON Patch Path for Key with Backslash #42

Closed
austince opened this issue Jul 15, 2019 · 2 comments
Closed

Escape JSON Patch Path for Key with Backslash #42

austince opened this issue Jul 15, 2019 · 2 comments

Comments

@austince
Copy link

How would one create the object { "valid/key": true } with JSON Patch? I can't find anything in the RFC.

@raymccrae
Copy link

raymccrae commented Sep 15, 2019

JSON Patch uses JSON Pointers to specify the path to elements of the JSON document. The answer you're looking for is documented in RFC6901, section 3. "~"(tilde) is encoded as "~0" and "/"(forward slash) is encoded as "~1".

[{"op": "add",  "path": "/valid~1key", "value": true}]

@austince
Copy link
Author

Ah great, thank you for pointing me there!

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