summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhar Hrachyshka <ihrachys@redhat.com>2014-08-21 11:09:15 +0200
committerIhar Hrachyshka <ihrachys@redhat.com>2014-08-22 13:44:58 +0200
commitf6dca124c1089521a89af68ed9b9ac98a2033001 (patch)
treef611752713f38513b1e3f0b4abab164401cb5ad2
parent692ae4c397c986bccc1a9c8ca205f9dab107fc41 (diff)
downloadoslo-serialization-f6dca124c1089521a89af68ed9b9ac98a2033001.tar.gz
Added JSONEncoder and JSONDecoder
Users may be interested in subclassing them, and they should not intermix different implementations, so let's provide them with implementation agnostic classes. Change-Id: I63ecd5dbbf78089d9e5c43ca5895c748eb23f070
-rw-r--r--oslo/serialization/jsonutils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/oslo/serialization/jsonutils.py b/oslo/serialization/jsonutils.py
index b2bdd7f..1edd76d 100644
--- a/oslo/serialization/jsonutils.py
+++ b/oslo/serialization/jsonutils.py
@@ -163,6 +163,10 @@ def to_primitive(value, convert_instances=False, convert_datetime=True,
return six.text_type(value)
+JSONEncoder = json.JSONEncoder
+JSONDecoder = json.JSONDecoder
+
+
def dumps(obj, default=to_primitive, **kwargs):
"""Serialize ``obj`` to a JSON formatted ``str``.
:param obj: object to be serialized