diff --git a/jsonobject/api.py b/jsonobject/api.py index 641967d..729b3c9 100644 --- a/jsonobject/api.py +++ b/jsonobject/api.py @@ -30,6 +30,13 @@ def __getstate__(self): def __setstate__(self, dct): self.__init__(dct) + def __eq__(self, other: object) -> bool: + if not isinstance(other, JsonObject): + raise TypeError( + "Expected an argument of type JsonObject, got: {}".format(type(other)) + ) + return sorted(self.items()) == sorted(other.items()) + class Meta(object): properties = { decimal.Decimal: properties.DecimalProperty,