Closed Jas-SinghFSU closed 4 years ago
JSON-Patch was not intended to create an object like the one that you suggested. However, the JSON pointer (the path) contains enough information to reconstruct an object void of the non-changed properties and objects. I suggest you loop through the patches and, for each patch, loop through the path while reconstructing the objects and arrays recursively. Whenever you encounter an integer, you now that there is an array and otherwise, you know there is an object with a property.
Hello, after running a compare operation on two documents, I get a list of patches. Is it possible to take these patches, for example:
Then build this patch into a JSON object like this?