本文整理了Java中net.sf.json.JSONArray.iterator()
方法的一些代码示例,展示了JSONArray.iterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.iterator()
方法的具体详情如下:
包路径:net.sf.json.JSONArray
类名称:JSONArray
方法名:iterator
暂无
代码示例来源:origin: jenkinsci/jenkins
for (Iterator<?> categoryIterator = pluginCategories.iterator(); categoryIterator.hasNext();) {
Object category = categoryIterator.next();
if (category instanceof JSONObject) {
JSONArray plugins = cat.getJSONArray("plugins");
nextPlugin: for (Iterator<?> pluginIterator = plugins.iterator(); pluginIterator.hasNext();) {
Object pluginData = pluginIterator.next();
if (pluginData instanceof JSONObject) {
代码示例来源:origin: zhangdaiscott/jeewx-api
/***
* 将对象转换为List对象
*
* @param object
* @return
*/
public static List toArrayList(Object object) {
List arrayList = new ArrayList();
JSONArray jsonArray = JSONArray.fromObject(object);
Iterator it = jsonArray.iterator();
while (it.hasNext()) {
JSONObject jsonObject = (JSONObject) it.next();
Iterator keys = jsonObject.keys();
while (keys.hasNext()) {
Object key = keys.next();
Object value = jsonObject.get(key);
arrayList.add(value);
}
}
return arrayList;
}
代码示例来源:origin: Arronlong/commonutils
/**
* json转map<String, Object>
*
* @param jsonStr
* @return
*/
public static Map<String, Object> json2Map(String jsonStr){
Map<String, Object> map = new HashMap<String, Object>();
//最外层解析
JSONObject json = JSONObject.fromObject(jsonStr);
for(Object k : json.keySet()){
Object v = json.get(k);
//如果内层还是数组的话,继续解析
if(v instanceof JSONArray){
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
@SuppressWarnings("unchecked")
Iterator<JSONObject> it = ((JSONArray)v).iterator();
while(it.hasNext()){
JSONObject json2 = it.next();
list.add(json2Map(json2.toString()));
}
map.put(k.toString(), list);
} else {
map.put(k.toString(), v);
}
}
return map;
}
代码示例来源:origin: bluebreezecf/SparkJobServerClient
/**
* {@inheritDoc}
*/
public List<String> getContexts() throws SparkJobServerClientException {
List<String> contexts = new ArrayList<String>();
final CloseableHttpClient httpClient = buildClient();
try {
HttpGet getMethod = new HttpGet(jobServerUrl + "contexts");
HttpResponse response = httpClient.execute(getMethod);
int statusCode = response.getStatusLine().getStatusCode();
String resContent = getResponseContent(response.getEntity());
if (statusCode == HttpStatus.SC_OK) {
JSONArray jsonArray = JSONArray.fromObject(resContent);
Iterator<?> iter = jsonArray.iterator();
while (iter.hasNext()) {
contexts.add((String)iter.next());
}
} else {
logError(statusCode, resContent, true);
}
} catch (Exception e) {
processException("Error occurs when trying to get information of contexts:", e);
} finally {
close(httpClient);
}
return contexts;
}
代码示例来源:origin: org.jenkins-ci.plugins/extended-choice-parameter
final int valuesBetweenLevels = this.value.split(",").length;
Iterator<?> it = jsonValues.iterator();
for(int i = 1; it.hasNext(); i++) {
String nextValue = it.next().toString();
strValue = StringUtils.join(jsonValues.iterator(), getMultiSelectDelimiter());
代码示例来源:origin: fluxtream/fluxtream-app
JSONArray hourly = weatherData.getJSONArray("hourly");
if (hourly!=null) {
@SuppressWarnings("rawtypes") Iterator iterator = hourly.iterator();
while (iterator.hasNext()) {
JSONObject hourlyRecord = (JSONObject) iterator.next();
代码示例来源:origin: bluebreezecf/SparkJobServerClient
if (statusCode == HttpStatus.SC_OK) {
JSONArray jsonArray = JSONArray.fromObject(resContent);
Iterator<?> iter = jsonArray.iterator();
while (iter.hasNext()) {
JSONObject jsonObj = (JSONObject)iter.next();
代码示例来源:origin: com.cerner.ccl.comm/j4ccl-ssh
/**
* Populate a variable-length list with data from a list of JSON data objects.
*
* @param array
* A {@link JSONArray} object from which JSON data objects with values will be pulled.
* @param recordList
* A {@link DynamicRecordList} object containing records into which values from the JSON data objects
* will be populated.
* @throws IllegalArgumentException
* If the size of the given array does not match the size of the record list.
*/
private static void putVariableListFromJson(final JSONArray array, final DynamicRecordList recordList) {
int listIndex = 0;
for (final Iterator<?> it = array.iterator(); it.hasNext();) {
final JSONObject object = (JSONObject) it.next();
/*
* Add a record if the size of the array exceeds the size of the list; otherwise, use an existing record
*/
if (listIndex + 1 > recordList.getSize())
putFromJsonObject(object, recordList.addItem());
else
putFromJsonObject(object, recordList.get(listIndex));
listIndex++;
}
}
}
代码示例来源:origin: gooddata/GoodData-CL
/**
* Returns the existing projects links
*
* @return accessible projects links
* @throws com.gooddata.exception.HttpMethodException
*/
@Deprecated
@SuppressWarnings("unchecked")
private Iterator<JSONObject> getProjectsLinks() throws HttpMethodException {
l.debug("Getting project links.");
HttpMethod req = createGetMethod(getServerUrl() + MD_URI);
try {
String resp = executeMethodOk(req);
JSONObject parsedResp = JSONObject.fromObject(resp);
JSONObject about = parsedResp.getJSONObject("about");
JSONArray links = about.getJSONArray("links");
l.debug("Got project links " + links);
return links.iterator();
} finally {
req.releaseConnection();
}
}
代码示例来源:origin: bioinformatics-ua/dicoogle
Iterator it = moves.iterator();
while(it.hasNext()){
JSONObject obj = (JSONObject) it.next();
代码示例来源:origin: locationtech/geowave
return new TheiaJSONFeatureIterator(this, type, features.iterator());
} catch (GeneralSecurityException | FactoryException e) {
throw new IOException(e);
代码示例来源:origin: toutatice-portail.cms/toutatice-portail-cms-nuxeo-api
Iterator<?> iterator = vocabulariesObj.iterator();
while (iterator.hasNext()) {
JSONObject vocabulary = (JSONObject) iterator.next();
代码示例来源:origin: gooddata/GoodData-CL
/**
* Returns the global platform links
*
* @return accessible platform links
* @throws com.gooddata.exception.HttpMethodException
*
*/
@SuppressWarnings("unchecked")
private Iterator<JSONObject> getPlatformLinks() throws HttpMethodException {
l.debug("Getting project links.");
HttpMethod req = createGetMethod(getServerUrl() + PLATFORM_URI);
try {
String resp = executeMethodOk(req);
JSONObject parsedResp = JSONObject.fromObject(resp);
JSONObject about = parsedResp.getJSONObject("about");
JSONArray links = about.getJSONArray("links");
l.debug("Got platform links " + links);
return links.iterator();
} finally {
req.releaseConnection();
}
}
代码示例来源:origin: locationtech/geowave
new AmazonJSONFeatureIterator(this, type, features.iterator());
if (!extraFilter.equals(Filter.INCLUDE)) {
final SceneFeatureIterator.CqlFilterPredicate filterPredicate =
代码示例来源:origin: Terry-Mao/gopush-cluster-sdk
JSONArray msgs = data.getJSONArray("msgs");
if (!msgs.isEmpty()) {
for (Iterator<?> it = msgs.iterator(); it.hasNext();) {
PushMessage message = (PushMessage) JSONObject.toBean((JSONObject) it.next(), PushMessage.class);
node.refreshMid(message.getMid());
for (Iterator<?> it = msgs.iterator(); it.hasNext();) {
PushMessage message = (PushMessage) JSONObject.toBean((JSONObject) it.next(), PushMessage.class);
node.refreshPmid(message.getMid());
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
for (Iterator<?> categoryIterator = pluginCategories.iterator(); categoryIterator.hasNext();) {
Object category = categoryIterator.next();
if (category instanceof JSONObject) {
JSONArray plugins = cat.getJSONArray("plugins");
nextPlugin: for (Iterator<?> pluginIterator = plugins.iterator(); pluginIterator.hasNext();) {
Object pluginData = pluginIterator.next();
if (pluginData instanceof JSONObject) {
内容来源于网络,如有侵权,请联系作者删除!