@importer('<STR_LIT>', ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'))<EOL>def load_json(filename, to='<STR_LIT>'):
from neuropythy.util import denormalize as denorm<EOL>if pimms.is_str(filename):<EOL><INDENT>try:<EOL><INDENT>with gzip.open(filename, '<STR_LIT>') as fl: dat = json.load(fl)<EOL><DEDENT>except Exception:<EOL><INDENT>with open(filename, '<STR_LIT>') as fl: dat = json.load(fl)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>dat = json.load(filename)<EOL>filename = '<STR_LIT>'<EOL><DEDENT>if to is None: return dat<EOL>elif to == '<STR_LIT>': return denorm(dat)<EOL>else: raise ValueError('<STR_LIT>' % to)<EOL>
load_json(filename) yields the object represented by the json file or stream object filename.

The optional argument to may be set to None to indicate that the JSON data should be returned
verbatim rather than parsed by neuropythy's denormalize system.