openmedialibrary/oml/json_pickler.py

12 lines
314 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)
return json.dumps(*args, **kargs).encode('utf-8')