Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Mechanism for Delta generation

Additional Details

Format/Conventions to be used for Delta Report (not finalized)

There are several ways of representing the differences between JSON but here we discuss the JSON Patch format of representing these differences because the proposed Delta report closely represents JSON patch with a few differences. This approach focuses in producing another JSON document that represents the differences between the two JSON's that have been compared.

...

The operation "op" field in a JSON patch document can have following values:

OperationDescriptionDelta report equivalent
addAdds the value at the target location; if the value exists in the given location, it’s replacedif the value is not present in the source json, but was found in the comparand json, then it should be considered an "add" action
removeRemoves the value at the target locationif a value was present at the source json, but was not found in the comparand json, then it should be considered as "delete" action
replaceReplaces the value at the target locationif a value is present in the source json, but an updated value is present in the comparand json, then it will be considered as "update" action
moveRemoves the value at a specified location and adds it to the target locationN/A
copyCopies the value at a specified location to the target locationN/A
testTests that a value at the target location is equal to a specified valueN/A


Code Block
titleSample JSON Patch
collapsetrue
[
     { "op": "test", "path": "/a/b/c", "value": "foo" },
     { "op": "remove", "path": "/a/b/c" },
     { "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },
     { "op": "replace", "path": "/a/b/c", "value": 42 },
     { "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
     { "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
   ]

...