Search json log file for a key=value pair.

    :param filepath: Valid path to a json file
    :param key: key to match
    :param value: value to match
    :returns: First matching line in json log file, parsed by :py:func:`json.loads`
766049
def search_json_log(filepath, key, value):
    
    try:
        with open(filepath, "r") as fh:
            for line in fh.readlines():
                    log = json.loads(line)
                    if key in log and log[key] == value:
                        return log
    except IOError:
        pass
    return False
511409
def read_json(filepath, intkeys=True, intvalues=True):
    
    d = json.load(ensure_open(find_filepath(filepath), mode='rt'))
    d = update_dict_types(d, update_keys=intkeys, update_values=intvalues)
    return d
960805
def parse(file_path):
    ''''''

    _, ext = path.splitext(file_path)

    if ext in ('.yaml', '.yml'):
        func = yaml.load

    elif ext == '.json':
        func = json.load

    else:
        raise ValueError("Unrecognized config file type %s" % ext)

    with open(file_path, 'r') as f:
        return func(f)
306749
def __load_file(self, key_list) -> str:
        
        file = str(key_list[0]) + self.extension
        key_list.pop(0)
        file_path = os.path.join(self.path, file)
        if os.path.exists(file_path):
            return Json.from_file(file_path)
        else:
            raise FileNotFoundError(file_path)
587523
def read_json_file(cls, path):
        
        with open(path, 'r') as f:
            json_string = f.read()
        return cls.from_json(json_string)
915317
function loadJson(filepath) {
	const json = fs.readFileSync(require.resolve(filepath), 'utf8');
	return JSON.parse(stripJsonComments(json));
}
245161
def read_json(file_path):
    
    try:
        with open(file_path, 'r') as f:
            config = json_tricks.load(f)
    except ValueError:
        print('    '+'!'*58)
        print('    Woops! Looks the JSON syntax is not valid in:')
        print('        {}'.format(file_path))
        print('    Note: commonly this is a result of having a trailing comma \n    in the file')
        print('    '+'!'*58)
        raise

    return config
644933
def from_json_path(path: str, check_version: bool = True) -> BELGraph:
    """"""
    with open(os.path.expanduser(path)) as f:
        return from_json_file(f, check_version=check_version)
214755
async function getDataFile(filePath) {
  ensureFileExists(filePath);
  const fileInfo = path.parse(filePath);
  try {
    switch (fileInfo.ext) {
      case '.json':
        const fileContents = await readFile(filePath, 'utf8');
        return JSON.parse(fileContents);
        break;
      case '.yml':
      case '.yaml':
        return await readYamlFile(filePath);
        break;
    }
  } catch (err) {
    log.errorAndExit('Could not getDataFile', err);
  }
}
1316819
public static ConfigurableJsonMatcher<String> jsonStringPartEquals(String path, Object expected) {
        return jsonPartEquals(path, expected);
    }
832743
def load(path, **kw):
    
    _kw = {}
    if PY3:  # pragma: no cover
        _kw['encoding'] = 'utf-8'
    with open(str(path), **_kw) as fp:
        return json.load(fp, **kw)
729741
def load_json_from_file(file_path):
    """"""
    try:
        with open(file_path) as f:
            json_data = json.load(f)
    except ValueError as e:
        raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e))
    else:
        return json_data
1271907
def load_file(self, path):
        
        res = None

        if not path:
            IOError("No path specified to save")

        if not os.path.isfile(path):
            raise IOError("File not found {}".format(path))

        try:
            with io.open(path, "r", encoding="utf-8") as f:
                if path.endswith(".json"):
                    res = self._load_json_file(f)
                elif path.endswith(".yaml") or path.endswith(".yml"):
                    res = self._load_yaml_file(f)
        except IOError:
            raise
        except Exception as e:
            self.exception("Failed reading {}".format(path))
            raise IOError(e)
        return res
1248865
def read_file(self, file_path):
        '''  '''
        getLogger().info("Loading app config from {} file: {}".format(self.__mode, file_path))
        if self.__mode == AppConfig.JSON:
            return json.loads(FileHelper.read(file_path), object_pairs_hook=OrderedDict)
        elif self.__mode == AppConfig.INI:
            config = configparser.ConfigParser(allow_no_value=True)
            config.read(file_path)
            return config
949087
def _ReadAppJsonFile(self, relative_path):
    
    try:
      with open(os.path.join(sys.path[0], relative_path), 'r') as f:
        return json.load(f)
    except (IOError, ValueError):
      return None
1201331
def load_json(path):
    # type: (str) -> OrderedDict
    
    with open(path, 'rt') as f:
        jsondict = json.loads(f.read(), object_pairs_hook=OrderedDict)
    if not jsondict:
        raise (LoadError('JSON file: %s is empty!' % path))
    return jsondict
688899
def load_json_dict(filename, *args):
	""""""
	data = {}
	if os.path.exists(filename):
		with open(filename, "r") as f:
			try:
				data = json.load(f)
				if not isinstance(data, dict):
					data = {}
			except:
				pass 
		if args:
			return {key: data[key] for key in args if key in data}
	return data