openmedialibrary/oml/json_pickler.py
2016-01-11 19:14:17 +05:30

12 lines
348 B
Python

import json
def loads(*args, **kwargs):
#print('loads', args, kwargs)
if isinstance(args[0], bytes):
args = (args[0].decode('utf-8'),) + args[1:]
return json.loads(*args, **kwargs)
def dumps(*args, **kwargs):
#print('dumps', args, kwargs)
kwargs['ensure_ascii'] = False
return json.dumps(*args, **kwargs).encode()