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
GH-139: Allow pointing to array elements via a reference field (#203)
* GH-139: Allow pointing to array elements via a reference field. Example path `/array/id=123/data`
* GH-139: Update README.md
* GH-139: Increase version
* GH-139: Incorporate review remarks
* GH-139: Clarify implementation details and limitations in the README.md
---------
Co-authored-by: kaistapel <kai.stapel@zalando.de>
Copy file name to clipboardExpand all lines: README.md
+34-3Lines changed: 34 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,16 @@
1
1
[](https://circleci.com/gh/flipkart-incubator/zjsonpatch/tree/master)[](https://gitter.im/zjsonpatch/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
2
3
-
# This is an implementation of [RFC 6902 JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) written in Java.
3
+
# This is an implementation of [RFC 6902 JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) written in Java with extended JSON pointer.
4
4
5
5
## Description & Use-Cases
6
6
- Java Library to find / apply JSON Patches according to [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902).
7
7
- JSON Patch defines a JSON document structure for representing changes to a JSON document.
8
8
- It can be used to avoid sending a whole document when only a part has changed, thus reducing network bandwidth requirements if data (in JSON format) is required to send across multiple systems over network or in case of multi DC transfer.
9
-
- When used in combination with the HTTP PATCH method as per [RFC 5789 HTTP PATCH](https://datatracker.ietf.org/doc/html/rfc5789), it will do partial updates for HTTP APIs in a standard way.
9
+
- When used in combination with the HTTP PATCH method as per [RFC 5789 HTTP PATCH](https://datatracker.ietf.org/doc/html/rfc5789), it will do partial updates for HTTP APIs in a standard way.
10
+
- Extended JSON pointer functionality (i.e. reference array elements via a key): `/array/id=123/data`
11
+
- The user has to ensure that a unique field is used as a reference key. Should there be more than one array
12
+
element matching the given key-value pair, the first element will be selected.
13
+
- Key based referencing may be slow for large arrays. Hence, standard index based array pointers should be used for large arrays.
- To find JsonPatch : Ω(N+M) ,N and M represents number of keys in first and second json respectively / O(summation of la*lb) where la , lb represents JSON array of length la / lb of against same key in first and second JSON ,since LCS is used to find difference between 2 JSON arrays there of order of quadratic.
24
+
- To find JsonPatch : Ω(N+M), N and M represents number of keys in first and second json respectively / O(summation of la*lb) where la , lb represents JSON array of length la / lb of against same key in first and second JSON ,since LCS is used to find difference between 2 JSON arrays there of order of quadratic.
21
25
- To Optimize Diffs ( compact move and remove into Move ) : Ω(D) / O(D*D) where D represents number of diffs obtained before compaction into Move operation.
22
26
- To Apply Diff : O(D) where D represents number of diffs
23
27
@@ -79,6 +83,33 @@ Following patch will be returned:
79
83
```
80
84
here `"op"` specifies the operation (`"move"`), `"from"` specifies the path from where the value should be moved, and `"path"` specifies where value should be moved. The value that is moved is taken as the content at the `"from"` path.
0 commit comments