jsonrpc.jsonutil
This module is primarily a wrapper around simplejson in order to make
it behave like demjson
- If an object being encoded has a ‘json_equivalent’ attribute, that will be called to get a (more)
serializable object
- if it has an ‘items’ method, it will be called
- if it defines both items and iteritems, the second will be used)
if it is iterable, it will be made into a list
otherwise ‘str’ will be called on the object, and that result will be used
-
jsonrpc.jsonutil.encode(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', **kw)
Serialize obj to json, if it is not of a type which the encoder can handle,
make it the proper type. Args and kw are as in json.dumps
-
jsonrpc.jsonutil.decode(str, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw)
Return an object from a json string. This is just json.loads() renamed