From 4bc61133c5f094ec69470403a35df1df1212ca65 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 12 Mar 2023 23:01:51 +0100 Subject: [PATCH] The Entity object should also have a `to_json` method. --- platypush/entities/_base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platypush/entities/_base.py b/platypush/entities/_base.py index 37840b7216..3ba822a215 100644 --- a/platypush/entities/_base.py +++ b/platypush/entities/_base.py @@ -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__`.