Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
string_types = basestring
class JsonDumper(object):
def __init__(self, **kwargs):
self.kwargs = kwargs
def __call__(self, obj, dest=None):
if dest is None:
return json.dumps(obj, **self.kwargs)
else:
return json.dump(obj, dest, **self.kwargs)
default_dumper = JsonDumper()
class JsonLoader(object):
def __init__(self, **kwargs):
self.kwargs = kwargs
def __call__(self, src):
if isinstance(src, string_types):
return json.loads(src, **self.kwargs)
else:
return json.load(src, **self.kwargs)
default_loader = JsonLoader()