@@ -13,6 +13,7 @@ A PHP implementation for finding unordered diff between two `JSON` documents.
1313 * To detect breaking changes by analyzing removals and changes from original ` JSON ` .
1414 * To keep original order of object sets (for example ` swagger.json ` [ parameters] ( https://swagger.io/docs/specification/describing-parameters/ ) list).
1515 * To make and apply JSON Patches, specified in [ RFC 6902] ( http://tools.ietf.org/html/rfc6902 ) from the IETF.
16+ * To retrieve and modify data by [ JSON Pointer] ( http://tools.ietf.org/html/rfc6901 ) .
1617
1718## Installation
1819
@@ -32,6 +33,8 @@ composer require swaggest/json-diff
3233
3334## Library usage
3435
36+ ### ` JsonDiff `
37+
3538Create ` JsonDiff ` object from two values (` original ` and ` new ` ).
3639
3740``` php
@@ -53,42 +56,76 @@ $r = new JsonDiff(
5356
5457On created object you have several handy methods.
5558
56- ### ` getPatch `
57- Returns ` JsonPatch ` of difference
59+ #### ` getPatch `
60+ Returns [ ` JsonPatch ` ] ( #jsonpatch ) of difference
5861
59- ### ` getRearranged `
62+ #### ` getRearranged `
6063Returns new value, rearranged with original order.
6164
62- ### ` getRemoved `
65+ #### ` getRemoved `
6366Returns removals as partial value of original.
6467
65- ### ` getRemovedPaths `
68+ #### ` getRemovedPaths `
6669Returns list of ` JSON ` paths that were removed from original.
6770
68- ### ` getRemovedCnt `
71+ #### ` getRemovedCnt `
6972Returns number of removals.
7073
71- ### ` getAdded `
74+ #### ` getAdded `
7275Returns additions as partial value of new.
7376
74- ### ` getAddedPaths `
77+ #### ` getAddedPaths `
7578Returns list of ` JSON ` paths that were added to new.
7679
77- ### ` getAddedCnt `
80+ #### ` getAddedCnt `
7881Returns number of additions.
7982
80- ### ` getModifiedOriginal `
83+ #### ` getModifiedOriginal `
8184Returns modifications as partial value of original.
8285
83- ### ` getModifiedNew `
86+ #### ` getModifiedNew `
8487Returns modifications as partial value of new.
8588
86- ### ` getModifiedPaths `
89+ #### ` getModifiedPaths `
8790Returns list of ` JSON ` paths that were modified from original to new.
8891
89- ### ` getModifiedCnt `
92+ #### ` getModifiedCnt `
9093Returns number of modifications.
9194
95+ ### ` JsonPatch `
96+
97+ #### ` import `
98+ Creates ` JsonPatch ` instance from ` JSON ` -decoded data.
99+
100+ #### ` export `
101+ Creates patch data from ` JsonPatch ` object.
102+
103+ #### ` op `
104+ Adds operation to ` JsonPatch ` .
105+
106+ #### ` apply `
107+ Applies patch to ` JSON ` -decoded data.
108+
109+ ### ` JsonPointer `
110+
111+ #### ` escapeSegment `
112+ Escapes path segment.
113+
114+ #### ` splitPath `
115+ Creates array of unescaped segments from ` JSON Pointer ` string.
116+
117+ #### ` add `
118+ Adds value to data at path specified by segments.
119+
120+ #### ` get `
121+ Gets value from data at path specified by segments.
122+
123+ #### ` getByPointer `
124+ Gets value from data at path specified ` JSON Pointer ` string.
125+
126+ #### ` remove `
127+ Removes value from data at path specified by segments.
128+
92129## Example
93130
94131``` php
0 commit comments