2014-09-02 22:32:44 +00:00
|
|
|
import json
|
|
|
|
|
2014-10-04 18:57:09 +00:00
|
|
|
def loads(*args, **kwargs):
|
|
|
|
#print('loads', args, kwargs)
|
2014-09-02 22:32:44 +00:00
|
|
|
if isinstance(args[0], bytes):
|
|
|
|
args = (args[0].decode('utf-8'),) + args[1:]
|
2017-01-06 15:37:02 +00:00
|
|
|
return json.loads(args[0], **kwargs)
|
2014-09-02 22:32:44 +00:00
|
|
|
|
2014-10-04 18:57:09 +00:00
|
|
|
def dumps(*args, **kwargs):
|
|
|
|
#print('dumps', args, kwargs)
|
2016-01-11 10:24:36 +00:00
|
|
|
kwargs['ensure_ascii'] = False
|
2017-01-06 15:37:02 +00:00
|
|
|
return json.dumps(args[0], **kwargs).encode()
|