Load a json file as a dictionary
173664
def load_json(filename):
    """"""
    try:
        if PY2:
            args = 'rb'
        else:
            args = 'r'
        with open(filename, args) as fid:
            data = json.load(fid)
        return data, None
    except Exception as err:
        return None, str(err)
357161
def _load_json(self, filename):
        """"""
        with open(filename, 'r') as file_handle:
            self._sensors.update(json.load(
                file_handle, cls=MySensorsJSONDecoder))
220055
def _loads(s):
    
    if isinstance(s, bytes):
        s = s.decode("utf-8")
    return pyjson.loads(s)
498364
def asDictionary(self):
        """"""
        if self._json_dict is None:
            self.__init(url=self._url)
        return self._json_dict
972584
def load(cls, fp, **kwargs):
    """"""
    json_obj = json.load(fp, **kwargs)
    return parse(cls, json_obj)
202373
def _load_json_config(self):
        
        try:
            return json.loads(self._read_config())
        except ValueError as error:
            raise ValueError(
                'Could not read configuration file: {}'.format(error))
452462
def loadrc(filename):
    '''
    
    '''
    filename = os.path.expanduser(os.path.expandvars(filename))
    if not os.path.isfile(filename): raise ValueError('Filename %s does not exist' % filename)
    with open(filename, 'r') as fl:
        dat = json.load(fl)
    try: dat = dict(dat)
    except Exception: raise ValueError('Given file %s does not contain a dictionary' % filename)
    return dat
397166
def loads(s, as_dict=False, *args, **kwargs):
    
    if as_dict or (not isinstance(s, six.string_types)):
        s = json.dumps(s)
    kwargs['object_hook'] = object_hook
    return json.loads(s, *args, **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)
    }
  })
}
737477
def from_json(cls, s):
        
        d = json.loads(s)
        return get_dict_handler(d["type"])(d)
792575
def loadcache(json_file):
    
    f = open(json_file, 'r')
    data = f.read()
    f.close()
    try:
        apicache = json.loads(data)
    except ValueError as e:
        print("Error processing json:", json_file, e)
        return {}
    return apicache
1078891
def load_json_object(file_name, default=None):
    
    if not os.path.isfile(file_name):
        return default

    # use utf-8-sig in case the file has a Byte Order Mark
    with codecs.open(file_name, 'r', 'utf-8-sig') as in_file:
        # read the text from the file
        content = in_file.read()

    # convert Windows line endings to Linux line endings
    content = content.replace('\r\n', '\n')

    # return a deserialized object
    return json.loads(content)
348431
def from_file(filename):
    
    f = open(filename, 'r')
    j = json.load(f)
    f.close()

    return from_dict(j)
1053716
def load_json_path(path):
    """"""
    with open(path) as handle:
        try: return json.load(handle, object_pairs_hook=collections.OrderedDict)
        except ValueError as error:
            message = "Could not decode JSON file '%s'." % path
            message = "-"*20 + "\n" + message + "\n" + str(error) + "\n" + "-"*20 + "\n"
            sys.stderr.write(message)
            raise error
272435
def load_json(path):
    
    try:
        with open(path, 'r') as json_file:
            return json.load(json_file)
    except (OSError, IOError):
        raise ClientException("File not found: {}".format(path))
444350
def json_loads(cls, s, **kwargs):
        
        if 'cls' not in kwargs:
            kwargs['cls'] = cls.json_decoder
        return json.loads(s, **kwargs)
85665
def _load_file(self):
        

        if not os.path.exists(self.file):
            return {}

        with open(self.file, "r") as infile:
            data = json.load(infile)

        return data