本文整理了Java中org.rapidoid.data.JSON.parse()
方法的一些代码示例,展示了JSON.parse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.parse()
方法的具体详情如下:
包路径:org.rapidoid.data.JSON
类名称:JSON
方法名:parse
暂无
代码示例来源:origin: rapidoid/rapidoid
@SuppressWarnings("unchecked")
public static Map<String, Object> parseMap(String json) {
return parse(json, Map.class);
}
代码示例来源:origin: rapidoid/rapidoid
public static byte[] parseBytes(String json) {
return parse(json, byte[].class);
}
代码示例来源:origin: rapidoid/rapidoid
@SuppressWarnings("unchecked")
private Map<String, ?> asMap() {
if (target instanceof String) {
return JSON.parse((String) target);
}
return as(Map.class);
}
代码示例来源:origin: rapidoid/rapidoid
public <T> T parse() {
return JSON.parse(fetch());
}
代码示例来源:origin: rapidoid/rapidoid
public static void warmUp() {
Msc.thread(() -> {
JSON.stringify(123);
JSON.parse("{}", Map.class);
});
}
代码示例来源:origin: rapidoid/rapidoid
case JSON:
try {
return JSON.parse(data, targetType);
} catch (Exception e) {
if (firstException == null) {
代码示例来源:origin: rapidoid/rapidoid
@SuppressWarnings("unchecked")
public void toUrlDecodedParams(Buf src, Map<String, Object> params, BufRanges contentTypes) {
for (int i = 0; i < count; i++) {
String key = keys[i].str(src.bytes());
String val = values[i].str(src.bytes());
boolean isJSON = isJSON(src, contentTypes, i);
key = URIs.urlDecodeOrKeepOriginal(key);
if (!isJSON) {
val = URIs.urlDecodeOrKeepOriginal(val);
if (key.endsWith("[]")) {
key = Str.sub(key, 0, -2);
List<String> list = (List<String>) params.get(key);
if (list == null) {
list = U.list();
params.put(key, list);
}
list.add(val);
} else {
params.put(key, val);
}
} else {
params.put(key, JSON.parse(val));
}
}
}
代码示例来源:origin: org.rapidoid/rapidoid-jackson
@SuppressWarnings("unchecked")
public static Map<String, Object> parseMap(String json) {
return parse(json, Map.class);
}
代码示例来源:origin: org.rapidoid/rapidoid-jackson
public static byte[] parseBytes(String json) {
return parse(json, byte[].class);
}
代码示例来源:origin: org.rapidoid/rapidoid-jackson
public static void warmup() {
JSON.stringify(123);
JSON.parse("{}", Map.class);
}
代码示例来源:origin: org.rapidoid/rapidoid-jackson
case JSON:
try {
return JSON.parse(data, targetType);
} catch (Exception e) {
if (firstException == null) {
代码示例来源:origin: org.rapidoid/rapidoid-buffer
@SuppressWarnings("unchecked")
public void toUrlDecodedParams(Buf src, Map<String, Object> params, BufRanges contentTypes) {
for (int i = 0; i < count; i++) {
String key = keys[i].str(src.bytes());
String val = values[i].str(src.bytes());
boolean isJSON = isJSON(src, contentTypes, i);
key = Msc.urlDecodeOrKeepOriginal(key);
if (!isJSON) {
val = Msc.urlDecodeOrKeepOriginal(val);
if (key.endsWith("[]")) {
key = Str.sub(key, 0, -2);
List<String> list = (List<String>) params.get(key);
if (list == null) {
list = U.list();
params.put(key, list);
}
list.add(val);
} else {
params.put(key, val);
}
} else {
params.put(key, JSON.parse(val));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!