本文整理了Java中net.minidev.json.JSONObject.keySet()
方法的一些代码示例,展示了JSONObject.keySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.keySet()
方法的具体详情如下:
包路径:net.minidev.json.JSONObject
类名称:JSONObject
方法名:keySet
暂无
代码示例来源:origin: net.minidev/json-smart
private static JSONObject merge(JSONObject o1, JSONObject o2) {
if (o2 == null)
return o1;
for (String key : o1.keySet()) {
Object value1 = o1.get(key);
Object value2 = o2.get(key);
if (value2 == null)
continue;
if (value1 instanceof JSONArray) {
o1.put(key, merge((JSONArray) value1, value2));
continue;
}
if (value1 instanceof JSONObject) {
o1.put(key, merge((JSONObject) value1, value2));
continue;
}
if (value1.equals(value2))
continue;
if (value1.getClass() .equals(value2.getClass()))
throw new RuntimeException("JSON merge can not merge two " + value1.getClass().getName() + " Object together");
throw new RuntimeException("JSON merge can not merge " + value1.getClass().getName() + " with " + value2.getClass().getName());
}
for (String key : o2.keySet()) {
if (o1.containsKey(key))
continue;
o1.put(key, o2.get(key));
}
return o1;
}
代码示例来源:origin: netplex/json-smart-v2
private static JSONObject merge(JSONObject o1, JSONObject o2) {
if (o2 == null)
return o1;
for (String key : o1.keySet()) {
Object value1 = o1.get(key);
Object value2 = o2.get(key);
if (value2 == null)
continue;
if (value1 instanceof JSONArray) {
o1.put(key, merge((JSONArray) value1, value2));
continue;
}
if (value1 instanceof JSONObject) {
o1.put(key, merge((JSONObject) value1, value2));
continue;
}
if (value1.equals(value2))
continue;
if (value1.getClass() .equals(value2.getClass()))
throw new RuntimeException("JSON merge can not merge two " + value1.getClass().getName() + " Object together");
throw new RuntimeException("JSON merge can not merge " + value1.getClass().getName() + " with " + value2.getClass().getName());
}
for (String key : o2.keySet()) {
if (o1.containsKey(key))
continue;
o1.put(key, o2.get(key));
}
return o1;
}
代码示例来源:origin: tomsik68/mclauncher-api
@Override
public IProfile[] read() throws Exception {
FileReader fileReader = new FileReader(dest);
JSONObject root = (JSONObject) JSONValue.parse(fileReader);
fileReader.close();
JSONObject authDatabase = (JSONObject) root.get("authenticationDatabase");
IProfile[] result = new IProfile[authDatabase.size()];
int i = 0;
for (String key : authDatabase.keySet()) {
result[i] = new YDAuthProfile((JSONObject) authDatabase.get(key));
++i;
}
return result;
}
代码示例来源:origin: SumiMakito/QuickKV
private boolean parseKVJS(JSONObject json) {
try {
Iterator<String> keys = json.keySet().iterator();
while (keys.hasNext()) {
String key = keys.next();
String val = json.get(key).toString();
Object k, v;
if (this.pKey != null && this.pKey.length() > 0) {
k = DataProcessor.Persistable.dePrefix(AES256.decode(this.pKey, key));
v = DataProcessor.Persistable.dePrefix(AES256.decode(this.pKey, val));
} else {
k = DataProcessor.Persistable.dePrefix(key);
v = DataProcessor.Persistable.dePrefix(val);
}
this.dMap.put(k, v);
}
return true;
} catch (Exception e) {
QKVLogger.ex(e);
return false;
}
}
代码示例来源:origin: salyh/elasticsearch-security-plugin
for (final String field : kibanaPermission.keySet()) {
代码示例来源:origin: org.jwall/stream-core
JSONObject object = parser.parse(line, JSONObject.class);
if (object != null) {
for (String key : object.keySet()) {
Object val = object.get(key);
if (val == null)
代码示例来源:origin: org.jwall/streams-core
JSONObject object = parser.parse(line, JSONObject.class);
if (object != null) {
for (String key : object.keySet()) {
Object val = object.get(key);
if (val == null)
代码示例来源:origin: de.sfb876/streams-core
JSONObject object = (JSONObject) parser.parse(data);
item = DataFactory.create();
for (String k : object.keySet()) {
item.put(k, (Serializable) object.get(k));
代码示例来源:origin: de.sfb876/streams-core
JSONObject object = parser.parse(line, JSONObject.class);
if (object != null) {
for (String key : object.keySet()) {
Object val = object.get(key);
if (val == null)
代码示例来源:origin: com.consol.citrus/citrus-core
return ((JSONObject) jsonPathResult).keySet();
} else {
return Collections.emptySet();
代码示例来源:origin: org.jwall/streams-core
JSONObject object = (JSONObject) parser.parse(data);
item = DataFactory.create();
for (String k : object.keySet()) {
item.put(k, (Serializable) object.get(k));
代码示例来源:origin: org.jwall/stream-core
for (String key : object.keySet()) {
Object data = object.get(key);
if (data instanceof Serializable) {
代码示例来源:origin: org.jwall/streams-core
for (String key : object.keySet()) {
Object data = object.get(key);
if (data instanceof Serializable) {
代码示例来源:origin: de.sfb876/streams-core
for (String key : object.keySet()) {
Object data = object.get(key);
if (data instanceof Serializable) {
代码示例来源:origin: tomsik68/mclauncher-api
public Library(JSONObject json) {
name = json.get("name").toString();
if (json.containsKey("natives")) {
JSONObject nativesObj = (JSONObject) json.get("natives");
for (String nativeKey : nativesObj.keySet()) {
String key = nativeKey;
String value = nativesObj.get(nativeKey).toString();
natives.put(key, value);
}
}
if (json.containsKey("rules")) {
JSONArray rulz = (JSONArray) json.get("rules");
for (int i = 0; i < rulz.size(); ++i) {
rules.add(new Rule((JSONObject) rulz.get(i)));
}
}
if (json.containsKey("extract")) {
extractRules = new LibraryExtractRules((JSONObject) json.get("extract"));
}
if (json.containsKey("url")) {
url = json.get("url").toString();
}
}
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
for(final String name: jsonObject.keySet()) {
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
for (final String name: json.keySet()) {
代码示例来源:origin: salyh/elasticsearch-security-plugin
for (final String field : dlsPermission.keySet()) {
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
for (final String name: jsonObject.keySet()) {
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
for(final String name: jsonObject.keySet()) {
内容来源于网络,如有侵权,请联系作者删除!