json-patch/json-patch2

Use an array to specify a property path

awwright opened this issue · 2 comments

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.

Is this a duplicate of #1?

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