bazaarvoice / json-regex-difftool

A JSON to JSON diff tool
Apache License 2.0
14 stars 11 forks source link

Diff doesn't handle case with 2 different sized map objects #4

Closed derek-rushing closed 9 years ago

derek-rushing commented 9 years ago

https://bazaarvoice.box.com/s/0oyo36oegfwkf0v9tr1nhb8jqhcq5647

has the costco and oldcostco.json files which fail when being compared through diff

a = JsonDiff("costco.json", "oldcostco.json") a.diff(False) # Should raise exception

cfstout commented 9 years ago

Why should this raise an exception? If you pass two different size maps into a diff, the tool will attempt to match sub portions of the map with each other. The parts that cannot be matched will be added to the output of the diff. The problem here is probably due to the default behavior uses an infinite depth on hierarchy to find a match and will do a best effort throughout nested layers of the json map. With large files like this, this can be VERY computationally expensive and thus will probably not return an answer.

cfstout commented 9 years ago

But I did find the exception that is being produced. Looks like it's the product of an index out of bounds request on an array.

cfstout commented 9 years ago

These files uncovered an additional problem with unicode encoding of the TradeMark symbol. I am working to fix that problem in parallel.

cfstout commented 9 years ago

Merged.