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
This commit is contained in:
Ihar Hrachyshka 2014-08-21 11:09:15 +02:00
parent 692ae4c397
commit f6dca124c1

View File

@ -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