The Entity object should also have a `to_json` method.

This commit is contained in:
Fabio Manganiello 2023-03-12 23:01:51 +01:00
parent 4a8da80c7c
commit 4bc61133c5
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 6 additions and 0 deletions

View File

@ -138,6 +138,12 @@ if 'entity' not in Base.metadata:
def to_dict(self) -> dict:
return {col.key: self._serialize_value(col) for col in self.columns}
def to_json(self) -> dict:
"""
Alias for :meth:`.to_dict`.
"""
return self.to_dict()
def __repr__(self):
"""
Same as :meth:`.__str__`.