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

How to add exclude nodes/keys in JSON during the comparison?

Open vignesh-thangaraj opened this issue 5 years ago • 1 comments

vignesh-thangaraj avatar Mar 01 '19 16:03 vignesh-thangaraj

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

espadrine avatar Jun 01 '21 11:06 espadrine