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

Use an array to specify a property path #24

Open
awwright opened this issue Feb 26, 2019 · 2 comments
Open

Use an array to specify a property path #24

awwright opened this issue Feb 26, 2019 · 2 comments

Comments

@awwright
Copy link

awwright commented Feb 26, 2019

JSON Patch specifies that paths be specified in a string format as specified by RFC 6901. This requires additional steps to form paths, first to escape characters (in a new, invented escape not used elsewhere), then joining the segments together prepended by a "/". This seems unnecessary.

JSON Patch should accept an array path format, where each item in the array descends into an object property (if a string) or an array item (if an integer). To adapt examples from RFC 6902:

   { "op": "add", "path": ["a", "b", "c"], "value": "foo" },
   { "op": "copy", "from": ["a", "b", "c"] "path": ["a", "b", "e"]},
   { "op": "remove", "path": ["foo", 1]},
   { "op": "test", "path": ["~1"], "value": 10},

etc.

@gregsdennis
Copy link

Is this a duplicate of #1?

@awwright
Copy link
Author

@gregsdennis This is formally stating one of the comments, but yeah nice catch

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