-
-
Notifications
You must be signed in to change notification settings - Fork 255
Description
Describe the bug
When comparing JsonObject
objects from google.cloud.spanner_v1.data_types, DeepDiff does not detect structural differences.
To Reproduce
from google.cloud.spanner_v1.data_types import JsonObject
from deepdiff import DeepDiff
print(DeepDiff(JsonObject([]), JsonObject([{"size": "L", "color": "red"}])))
print(DeepDiff(JsonObject([]).serialize(),
JsonObject([{"size": "L", "color": "red"}]).serialize()))
Gives Output:
{}
{'values_changed': {'root': {'new_value': '[{"color":"red","size":"L"}]', 'old_value': '[]'}}}
Expected behavior
DeepDiff should support comparing JsonObject (and similar serializable custom objects) by normalizing them to Python dict/list internally. This would allow structural diffs without requiring users to manually call .serialize() and json.loads() everywhere.
If built-in support is not feasible, please let me know if there are any existing hooks (e.g., custom operators, extension points) that DeepDiff provides to handle this scenario more elegantly.
OS, DeepDiff version and Python version:
- OS: NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.1 - Python Version 3.11.13
- DeepDiff Version 8.6.1