12 lines
348 B
Python
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()
|