Loads user-defined preferences from JSON
@param {Object} json
@returns
163423
function(json) {
			Object.keys(json).forEach(function(key) {
				this.set(key, json[key]);
			}, this);
		}
775099
function parseJSON(str) {
                                            var result;
                                            try {
                                                result = $scope.options.parserFn(str);
                                            } catch (e) {
                                                return str;
                                            }
                                            return result;
                                        }
1207041
def loadJson(d):
    """"""
    with codecs.open(jsonFn(d), 'r', 'utf-8') as f:
        return json.load(f)
319449
def load_json(self, json):
        """"""
        for key in json:
            if key == "wandb_version":
                continue
            self._items[key] = json[key].get('value')
            self._descriptions[key] = json[key].get('desc')
1206645
public static <T> List<T> loadJsonValues(File json, Class<T> clazz) throws IOException {
        List<T> answer = new ArrayList<>();
        if (json.exists() && json.isFile()) {
            MappingIterator<T> iter = objectMapper.readerFor(clazz).readValues(json);
            while (iter.hasNext()) {
                answer.add(iter.next());
            }
        }
        return answer;
    }
449592
private JSONArray readOptionalArray(JSONObject json, String key) {

        try {
            return json.getJSONArray(key);
        } catch (JSONException e) {
            LOG.debug("Reading optional JSON array failed. Default to provided default value.", e);
        }
        return null;
    }
534917
@Nullable
    public static <T> T getJson(@NonNull SharedPreferences prefs,
            @NonNull String key, @NonNull Class<T> clazz) {
        return getJson(prefs, key, (Type) clazz);
    }
1065604
def load(json_src, save=False):
    """"""
    if isinstance(json_src, six.string_types):
        json_src = json_lib.loads(json_src)

    if isinstance(json_src, list):
        return [getattr(objects, obj['class']).load(obj, save)
                for obj in json_src]

    return getattr(objects, json_src['class']).load(json_src, save)
1201359
function view_json(req, src, options, end) {
    load(src
        , {
            authorization: req.headers['authorization'],
            X_Forwarded_For: req.X_Forwarded_For
        }

        , function(status, result) {
            if (status !== true) {
                return end(false, 'status > ' + status);
            };

            result.get(['json'], function(status, data) {
                if (status == true) {
                    if (options.yaml) {
                        data = yaml.safeDump(data, {indent: options.yaml});
                    } else {
                        data = JSON.stringify(data, null, "\t");
                    };

                } else {
                    data = 'status > ' + status;
                };

                end(status, data);
            });
        }
    );
}
11184
private void loadEntireJsonObject(JSONObject json) throws JSONException {
    Iterator<?> it = json.keys();
    while (it.hasNext()) {
      // This key is something like core-site.xml or hdfs-site.xml
      Object obj = it.next();
      if (!(obj instanceof String)) {
        LOG.warn("Object not instance of string : " + obj + " skipping");
        continue;
      }
      String key = (String) obj;
      JSONObject partition = json.getJSONObject(key);
      loadJsonResource(partition, properties, key);
    }
  }
1127497
function(options) {
  var r = null;
  if (options.readPreference) {
    r = options.readPreference;
  } else {
    return options;
  }

  if (typeof r === 'string') {
    options.readPreference = new ReadPreference(r);
  } else if (r && !(r instanceof ReadPreference) && typeof r === 'object') {
    const mode = r.mode || r.preference;
    if (mode && typeof mode === 'string') {
      options.readPreference = new ReadPreference(mode, r.tags, {
        maxStalenessSeconds: r.maxStalenessSeconds
      });
    }
  } else if (!(r instanceof ReadPreference)) {
    throw new TypeError('Invalid read preference: ' + r);
  }

  return options;
}
791271
function loadRemoteJson(options, done) {
	var requestOptions = {
		url: options.url,
		headers: options.headers
	};
	var error;

	request(requestOptions, function (err, response, body) {
		if (err) {
			return done(error);
		}
		if (response.statusCode < 200 || response.statusCode >= 300) {
			error = new Error('Remote JSON responded with ' + response.statusCode + ' status');
			error.status = response.statusCode;
			return done(error);
		}
		try {
			body = JSON.parse(body);
		} catch (err) {
			return done(err);
		}
		done(null, body);
	});
}
899112
public void fromJSON(JSONObject json, String rootPath) {

        try {
            // language versions
            if (json.has(JSON_LANGUAGES)) {
                JSONArray jsonLanguages = json.getJSONArray(JSON_LANGUAGES);
                for (int i = 0; i < jsonLanguages.length(); i++) {
                    JSONObject jsonLang = (JSONObject)jsonLanguages.get(i);

                    CmsDocumentDependency lang = new CmsDocumentDependency(null, jsonLang.getString(JSON_PATH));
                    lang.fromJSON(jsonLang, rootPath);
                    addVariant(lang);
                }
            }

            // attachments
            if (json.has(JSON_ATTACHMENTS)) {
                JSONArray jsonAttachments = json.getJSONArray(JSON_ATTACHMENTS);
                for (int i = 0; i < jsonAttachments.length(); i++) {
                    try {
                        JSONObject jsonAttachment = (JSONObject)jsonAttachments.get(i);

                        CmsDocumentDependency att = new CmsDocumentDependency(
                            null,
                            jsonAttachment.getString(JSON_PATH));
                        att.fromJSON(jsonAttachment, rootPath);

                        // language versions of attachment
                        if (jsonAttachment.has(JSON_LANGUAGES)) {
                            JSONArray jsonAttLanguages = jsonAttachment.getJSONArray(JSON_LANGUAGES);
                            for (int j = 0; j < jsonAttLanguages.length(); j++) {
                                JSONObject jsonAttLanguage = (JSONObject)jsonAttLanguages.get(j);

                                CmsDocumentDependency attLang = new CmsDocumentDependency(
                                    null,
                                    jsonAttLanguage.getString(JSON_PATH));
                                attLang.fromJSON(jsonAttLanguage, rootPath);
                                att.addVariant(attLang);
                            }
                        }
                        addAttachment(att);
                    } catch (Exception e) {
                        LOG.error(e);
                    }
                }
            }
        } catch (Exception ex) {
            if (LOG.isErrorEnabled()) {
                LOG.error(ex.getLocalizedMessage(), ex);
            }
        }
    }
793802
public static ReadContext fromJson(String json) {
        Objects.requireNonNull(json, Required.JSON.toString());
        
        return JsonPath.parse(json);
    }
597472
function(json) {
	return({
		values: json,
		depth: 1,

		// map over all rows to get the set of properties available in each document
		series_list: _.reduce(json, function(res, row, key) {
			return _.uniq( res.concat( _.plain( row ).keys().value() ) );
		}, [])
	});
}
498197
private SortedSet<Date> readDates(JSONValue json) {

        JSONArray array = null == json ? null : json.isArray();
        if (null != array) {
            SortedSet<Date> result = new TreeSet<>();
            for (int i = 0; i < array.size(); i++) {
                Date d = readOptionalDate(array.get(i));
                if (null != d) {
                    result.add(d);
                }
            }
            return result;
        }
        return new TreeSet<>();
    }
252303
def convert_loaded_json(js):
    
    if not isinstance(js, (Mapping, tuple, list)):
        return try_convert(js)
    try:
        return type(js)(convert_loaded_json(item) for item in js.iteritems())
    except:
        try:
            return type(js)(convert_loaded_json(item) for item in iter(js))
        except:
            return try_convert(js)