Consider the following Jsons:
Source:
{
"store": {
"a": [
"v1",
"v2"
]
}
}
Target:
running JsonDiff.asJson(source, target) returns:
[ {
"op" : "remove",
"path" : "/store/a/0"
}, {
"op" : "remove",
"path" : "/store/a/0"
} ]
which as it is seen both path is same but actually the next path should be "/store/a/1". The reason is there is a bug in JsonDiff class in function generateArrayDiffs. There is a for loop as:
for(index = size; index < firstSize; ++index) {
processor.valueRemoved(pointer.append(size), source.get(index));
}
Which should be changed to:
for(index = size; index < firstSize; ++index) {
processor.valueRemoved(pointer.append(index), source.get(index));
}
Consider the following Jsons:
Source:
Target:
running
JsonDiff.asJson(source, target)returns:which as it is seen both path is same but actually the next path should be
"/store/a/1". The reason is there is a bug in JsonDiff class in function generateArrayDiffs. There is a for loop as:Which should be changed to: