You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An element to add to an existing array - whereupon the supplied
value is added to the array at the indicated location. Any
elements at or above the specified index are shifted one position
to the right. The specified index MUST NOT be greater than the
number of elements in the array. If the "-" character is used to
index the end of the array (see [RFC6901]), this has the effect of
appending the value to the array.
varobj={arr: ["item 1","item 2"]}varpatch=[{op: 'add',path: '/arr/-',value: 'item 3'}]// obj should be { arr: [ "item 1", "item 2", "item 3" ] }// but is { arr: [ "item 3", "item 1", "item 2" ] }
I think it's reasonable to not generate hyphen patches, but it should be possible to apply them.
Excerpt from JSON-patch spec (section 4.1):
I think it's reasonable to not generate hyphen patches, but it should be possible to apply them.
I think change to https://github.com/Starcounter-Jack/JSON-Patch/blob/master/src/json-patch.js#L91 would work as follows:
I can create formal pull request with updated tests if you would prefer. What's your build process?
The text was updated successfully, but these errors were encountered: