本文整理了Java中org.codehaus.jettison.json.JSONObject.toJSONArray()
方法的一些代码示例,展示了JSONObject.toJSONArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.toJSONArray()
方法的具体详情如下:
包路径:org.codehaus.jettison.json.JSONObject
类名称:JSONObject
方法名:toJSONArray
[英]Produce a JSONArray containing the values of the members of this JSONObject.
[中]生成包含此JSONObject成员值的JSONArray。
代码示例来源:origin: com.atlassian.jira/jira-rest-java-client
static Collection<String> extractErrors(String body) throws JSONException {
JSONObject jsonObject = new JSONObject(body);
final Collection<String> errorMessages = new ArrayList<String>();
final JSONArray errorMessagesJsonArray = jsonObject.optJSONArray("errorMessages");
if (errorMessagesJsonArray != null) {
errorMessages.addAll(JsonParseUtil.toStringCollection(errorMessagesJsonArray));
}
final JSONObject errorJsonObject = jsonObject.optJSONObject("errors");
if (errorJsonObject != null) {
final JSONArray valuesJsonArray = errorJsonObject.toJSONArray(errorJsonObject.names());
if (valuesJsonArray != null) {
errorMessages.addAll(JsonParseUtil.toStringCollection(valuesJsonArray));
}
}
return errorMessages;
}
代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3
static Collection<String> extractErrors(String body) throws JSONException {
JSONObject jsonObject = new JSONObject(body);
final Collection<String> errorMessages = new ArrayList<String>();
final JSONArray errorMessagesJsonArray = jsonObject.optJSONArray("errorMessages");
if (errorMessagesJsonArray != null) {
errorMessages.addAll(JsonParseUtil.toStringCollection(errorMessagesJsonArray));
}
final JSONObject errorJsonObject = jsonObject.optJSONObject("errors");
if (errorJsonObject != null) {
final JSONArray valuesJsonArray = errorJsonObject.toJSONArray(errorJsonObject.names());
if (valuesJsonArray != null) {
errorMessages.addAll(JsonParseUtil.toStringCollection(valuesJsonArray));
}
}
return errorMessages;
}
代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3
static Collection<String> extractErrors(String body) throws JSONException {
JSONObject jsonObject = new JSONObject(body);
final Collection<String> errorMessages = new ArrayList<String>();
final JSONArray errorMessagesJsonArray = jsonObject.optJSONArray("errorMessages");
if (errorMessagesJsonArray != null) {
errorMessages.addAll(JsonParseUtil.toStringCollection(errorMessagesJsonArray));
}
final JSONObject errorJsonObject = jsonObject.optJSONObject("errors");
if (errorJsonObject != null) {
final JSONArray valuesJsonArray = errorJsonObject.toJSONArray(errorJsonObject.names());
if (valuesJsonArray != null) {
errorMessages.addAll(JsonParseUtil.toStringCollection(valuesJsonArray));
}
}
return errorMessages;
}
内容来源于网络,如有侵权,请联系作者删除!