Why is this returning dictionaries with unhashable key names?
axfelix opened this issue · comments
Hi,
Unless I'm missing something, it's unnecessarily difficult to do a .get("delete", None)
on the dictionaries returned by jsondiff.diff()
because the keys are named delete
rather than "delete"
. Is this intentional, and is there a workaround I'm not aware of?
Thanks!
@akhilkumard where did you fix it? Do you have a PR?
Actually, I think what you are looking for is this:
>>> import jsondiff as jd
>>> d = diff(['a', 'b', 'c'], ['a', 'c'])
>>> d.get(jd.delete)
[1]
The docs are, admittedly, not first class.
Thanks, that works. Would appreciate it being documented though! That wouldn't have occurred to me.
I agree, will update and close the issue afterwards.
got this from another issue, works also on arbitrary nested stuff:
jsondiff(d1, d2, marshal=True)
should be the default imho, at least it should be documented.
Ah I wasted some time on this too. Should have checked the issues earlier. +1 for documentation update, been 6+ months now.