Reads the file specified from json and creates an object based on the id of each element

        :param str file: Path to file of json to read

        :return: object of data read from json file

        :rtype: object
485925
def _read_from_json(self, file):
        

        try:
            with io.open(os.path.join(self._PATH, file), encoding="utf8") as f:
                return {u["id"]: u for u in json.load(f)}
        except IOError:
            return {}
994159
def read(path, create_file=False):
        
        if create_file:
            with open(str(path), 'a+') as data_file:
                data_file.seek(0)
                return json.load(data_file)

        else:
            with open(str(path)) as data_file:
                return json.load(data_file)
763031
def from_file(cls, path):

        

        with open(path, 'r', errors='replace') as f:
            return cls(f.read())
910687
def from_file(cls, filename):
        
        import csv
        with open(filename, 'r') as f:
            reader = csv.DictReader(f)
            row = reader.next()  # Only one row in the file
        try:
            cls.ACCESS_KEY_ID = row['Access Key Id']
            cls.SECRET_ACCESS_KEY = row['Secret Access Key']
        except KeyError:
            raise IOError('Invalid credentials format')
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
140420
def from_json_file(cls, json_file):
        """"""
        with open(json_file, "r", encoding="utf-8") as reader:
            text = reader.read()
        return cls.from_dict(json.loads(text))
1242147
def parse_json(json_file):
    
    if not os.path.exists(json_file):
        return None

    try:
        with open(json_file, "r") as f:
            info_str = f.readlines()
            info_str = "".join(info_str)
            json_info = json.loads(info_str)
            return unicode2str(json_info)
    except BaseException as e:
        logging.error(e.message)
        return None
1056733
def readConfigFromJSON(self, fileName):
        
        self.__logger.debug("readConfigFromJSON: reading from " + fileName)
        with open(fileName) as data_file:
            data = load(data_file)
        self.readConfig(data)
579202
def parse(string, is_file=False, obj=False):
        
        try:
            if obj is False:
                if is_file:
                    return system_json.load(string)
                return system_json.loads(string, encoding='utf8')
            else:
                if is_file:
                    return system_json.load(
                        string,
                        object_hook=lambda d: namedtuple('j', d.keys())
                        (*d.values()), ensure_ascii=False, encoding='utf8')
                return system_json.loads(
                    string,
                    object_hook=lambda d: namedtuple('j', d.keys())
                    (*d.values()), encoding='utf8')
        except (Exception, BaseException) as error:
            try:
                if current_app.config['DEBUG']:
                    raise error
            except RuntimeError as flask_error:
                raise error
            return None
365305
def read_file(self):
        
        file_obj = open(self.file, 'r')
        content = file_obj.read()
        file_obj.close()
        if content:
            content = json.loads(content)
            return content
        else:
            return {}
486672
def read_dict_or_list_from_json(desired_type: Type[dict], file_object: TextIOBase,
                                logger: Logger, conversion_finder: ConversionFinder, **kwargs) -> Dict[str, Any]:
    
    # lazy import in order not to force use of jprops
    import json
    res = json.load(file_object)

    # convert if required
    return ConversionFinder.convert_collection_values_according_to_pep(res, desired_type, conversion_finder, logger, **kwargs)
1339072
function loadJSON (file, callback) {
  loadText(file, function (err, data) {
    if (err) {
      callback(err, null)
    } else {
      var json = null
      try {
        json = JSON.parse(data)
      } catch (e) {
        return callback(e, null)
      }
      callback(null, json)
    }
  })
}
644251
def load_json(json_object):
   '''  '''
   content = None
   if isinstance(json_object, str) and os.path.exists(json_object):
      with open_(json_object) as f:
         try:
            content = json.load(f)
         except Exception as e:
            debug.log("Warning: Content of '%s' file is not json."%f.name)
   elif hasattr(json_object, 'read'):
      try:
         content = json.load(json_object)
      except Exception as e:
         debug.log("Warning: Content of '%s' file is not json."%json_object.name)
   else:
      debug.log("%s\nWarning: Object type invalid!"%json_object)
   return content
314104
def from_file(cls, f):
        

        with open_file_like(f, 'r') as fp:
            return cls(json.load(fp))
571183
def read(file)

      Pathname.new(file).read.each_line do |line|
          # skip blank lines and those starting with #
          next if line =~ /^\s*(#|$)/

          line.strip =~ /^(\w+?):\s*(\S.*)$/
          next unless $1
          attr = $1.to_sym
          setter = "#{attr}=".to_sym
          value = $2.strip

          if CONF_KEYS.keys.include? attr
            if value
              # convert the value to the correct class
              value = value.send(CONF_KEYS[attr])
            end
            self.send(setter, value)
          end  # if
        end # do line

    end
319712
def read_dict(file_name, clear_none=False, encoding='utf-8'):
    
    with open(file_name, 'rb') as f:
        data = f.read()

    if encoding is not None:
        data = data.decode(encoding)

    line_list = data.splitlines()
    data = []
    i = 0
    for line in line_list:
        i += 1
        try:
            line = force_text(line).strip()
            data.append(line)
        except:
            print('read error line %s' % i)
    if clear_none:
        data = [t for t in data if t != '']
    data = deque(data)
    return data
406929
def fromFile(cls, filename):
		

		# Load the file
		oFile = open(filename)

		# Convert it to a dictionary
		dDetails = JSON.decodef(oFile)

		# Create and return the new instance
		return cls(dDetails)