json-diff
json-diff copied to clipboard
How to add exclude nodes/keys in JSON during the comparison?
Hi Dookiee!
I don’t think you can do it in the current API, short of removing the keys before passing the JSON in.
What is the intent? Is it to speed up computation, or fix incorrect matching?
If it is the latter, you can pass in a custom similarity
procedure that handle those keys specifically, and fallback to the default algorithm for others. See: https://github.com/espadrine/json-diff/blob/6cac5769fba24db78cb1159e8139dd2148d45e2a/spec/json-diff/diff_spec.rb#L152-L168