json-diff icon indicating copy to clipboard operation
json-diff copied to clipboard

Boolean diff report

Open reharik opened this issue 2 years ago • 1 comments

Is there a way or can there be a way to get a boolean result from the diff, or perhaps, if there are no differences return a single empty object or string? I'm trying to run this on a bunch of documents from the db and have a result that is filtered by hasDiff. Right now I have to sort of iterate over everything and check if there's anything in each of the objects. Thanks, Raif

reharik avatar Oct 19 '22 16:10 reharik

@reharik -- As designed, this returns an empty result when there is no difference. Can you provide the simplest example of the two objects you are diffing that show output when identical?

example:

$ ./bin/json-diff.js --raw-json <(echo '{"a":4, "b":6}') <(echo '{"a":5,"b":6}')
{
  "a": {
    "__old": 4,
    "__new": 5
  }
}
$ ./bin/json-diff.js --raw-json <(echo '{"a":4, "b":6}') <(echo '{"a":4,"b":6}')
$

ewoudenberg avatar Oct 26 '22 13:10 ewoudenberg