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:
parent
692ae4c397
commit
f6dca124c1
@ -163,6 +163,10 @@ def to_primitive(value, convert_instances=False, convert_datetime=True,
|
|||||||
return six.text_type(value)
|
return six.text_type(value)
|
||||||
|
|
||||||
|
|
||||||
|
JSONEncoder = json.JSONEncoder
|
||||||
|
JSONDecoder = json.JSONDecoder
|
||||||
|
|
||||||
|
|
||||||
def dumps(obj, default=to_primitive, **kwargs):
|
def dumps(obj, default=to_primitive, **kwargs):
|
||||||
"""Serialize ``obj`` to a JSON formatted ``str``.
|
"""Serialize ``obj`` to a JSON formatted ``str``.
|
||||||
:param obj: object to be serialized
|
:param obj: object to be serialized
|
||||||
|
Loading…
Reference in New Issue
Block a user