openmedialibrary/oml/json_pickler.py

12 lines
307 B
Python
Raw Normal View History

2014-09-02 22:32:44 +00:00
import json
def loads(*args, **kargs):
#print('loads', args, kargs)
if isinstance(args[0], bytes):
args = (args[0].decode('utf-8'),) + args[1:]
return json.loads(*args, **kargs)
def dumps(*args, **kargs):
#print('dumps', args, kargs)
2014-09-09 10:08:04 +00:00
return json.dumps(*args, **kargs).encode()