Can anybody suggest some Java Library or Code to get a diff of two JSON Strings?
I had the exact same problem and ended up writing my own library:
https://github.com/algesten/jsondiff
It does both diffing/patching.
Diffs are JSON-objects themselves and have a simple syntax for object merge/replace and array insert/replace.
Example:
original
{
a: { b: 42 }
}
patch
{
"~a" { c: 43 }
}
The ~
indicates an object merge.
result
{
a: { b: 42, c: 43 }
}