only pass data to json.dumps/loads
This commit is contained in:
parent
6e06214104
commit
6356e9acf2
1 changed files with 2 additions and 2 deletions
|
@ -4,9 +4,9 @@ def loads(*args, **kwargs):
|
||||||
#print('loads', args, kwargs)
|
#print('loads', args, kwargs)
|
||||||
if isinstance(args[0], bytes):
|
if isinstance(args[0], bytes):
|
||||||
args = (args[0].decode('utf-8'),) + args[1:]
|
args = (args[0].decode('utf-8'),) + args[1:]
|
||||||
return json.loads(*args, **kwargs)
|
return json.loads(args[0], **kwargs)
|
||||||
|
|
||||||
def dumps(*args, **kwargs):
|
def dumps(*args, **kwargs):
|
||||||
#print('dumps', args, kwargs)
|
#print('dumps', args, kwargs)
|
||||||
kwargs['ensure_ascii'] = False
|
kwargs['ensure_ascii'] = False
|
||||||
return json.dumps(*args, **kwargs).encode()
|
return json.dumps(args[0], **kwargs).encode()
|
||||||
|
|
Loading…
Reference in a new issue