def read_json(file_or_path):
try:<EOL><INDENT>with (open(file_or_path, '<STR_LIT:r>') if isinstance(file_or_path, (str, bytes)) else file_or_path) as f:<EOL><INDENT>obj = json.load(f)<EOL><DEDENT><DEDENT>except IOError:<EOL><INDENT>obj = json.loads(file_or_path)<EOL><DEDENT>return obj<EOL>
Parse json contents of string or file object or file path and return python nested dict/lists