...
In order to find the values that have been updated between two data nodes, each leaf node present under the source data node is to be accessed and compared to the leaf node present under the target data node. In doing so all the information about the data nodes relation to other data nodes is lost, because the algorithm first flattens all the data nodes into a linear structure for easier comparision.
Then the algorithm accesses the source and target data node based on their xpath
When it finds source and target data nodes having the same xpath, we fetch the individual leaves nodes of the data node, these leaves are then compared and if any changes detected the leaves are added to the delta report.
Since the data is accessed at a low level (leaf node) to generate the delta report, it becomes impossible to reconstruct is not feasible to restructure the data node back and represent the updated data in the original JSON/XML structure. Because the delta operation is purely a GET operation and reconstructing the original structure of JSON requires some kind of data manipulation to take place which is not recommended in a GET operation. Therefore, the best approach is to provide the delta of updated nodes individually irrespective of the fact that they are in a parent-child relationship.Reconstructing the data node to represent the original data structure would require some kind of data manipulation which is not suitable as it could lead to discrepancies in the delta that is generated.
The same is described below in form of the flowchart.
...