summaryrefslogtreecommitdiff
path: root/libs/json_tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'libs/json_tools.py')
-rwxr-xr-xlibs/json_tools.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/json_tools.py b/libs/json_tools.py
new file mode 100755
index 0000000..5c26b24
--- /dev/null
+++ b/libs/json_tools.py
@@ -0,0 +1,12 @@
+import json
+
+
+class JsonSerializable(object):
+ def __repr__(self):
+ return str(self.to_json())
+
+ def to_json(self):
+ return json.dumps(self.__dict__, ensure_ascii=False)
+
+ def to_dict(self):
+ return self.__dict__ \ No newline at end of file