Java Code Examples for net.sf.json.JSONArray#toList()

The following examples show how to use net.sf.json.JSONArray#toList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JwMediaAPI.java    From jeewx-api with Apache License 2.0 6 votes vote down vote up
/**
 * 获取永久素材  
 * 
 * @param accesstoken
 * @param wxArticles
 *            图文集合,数量不大于10
 * @return WxArticlesResponse 上传图文消息素材返回结果
 * @throws WexinReqException
 */
public static List<WxNewsArticle> getArticlesByMaterialNews(String accesstoken,String mediaId) throws WexinReqException {
	List<WxNewsArticle> wxArticleList = null;
		if (accesstoken != null) {
			String requestUrl = material_get_material_url.replace("ACCESS_TOKEN", accesstoken);
			JSONObject obj = new JSONObject();
			obj.put("media_id", mediaId);
			JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
			if (result.has("errcode")) {
				logger.error("获取永久素材 失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
				throw new WexinReqException(result.getString("errcode"));
			} else {
				logger.info("====获取永久素材成功====result:"+result.toString());
				JSONArray newsItemJsonArr = result.getJSONArray("news_item");
				wxArticleList = JSONArray.toList(newsItemJsonArr, WxNewsArticle.class);
			}
	}
	return wxArticleList;
}
 
Example 2
Source File: JwTagAPI.java    From jeewx-api with Apache License 2.0 6 votes vote down vote up
/**
 * 获取标签
 */
public static List<WxTag> getTags(String accessToken){
	List<WxTag> list = null;
	if(accessToken != null){
		String requestUrl = get_tag.replace("ACCESS_TOKEN", accessToken);
		//logger.info("创建标签方法执行前json参数 obj: "+obj.toString());
		JSONObject result = WxstoreUtils.httpRequest(requestUrl, "GET", null);
		Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
		if(error == null){
			String tags = result.getString("tags");
			JSONArray jsonArray = JSONArray.fromObject(tags);
			list = JSONArray.toList(jsonArray, WxTag.class);
			return list;
		}
		logger.info("获取标签方法执行后json参数 : "+result.toString());
	}
	return list;
}
 
Example 3
Source File: JwTagAPI.java    From jeewx-api with Apache License 2.0 6 votes vote down vote up
/**
 * 获取用户身上的标签列表
 */
public static List<Integer> getidlist(String accessToken,String openid){
	List<Integer> list = null;
	if(accessToken != null){
		String requestUrl = getidlist.replace("ACCESS_TOKEN", accessToken);
		Map<String,Object> data = new HashMap<String,Object>();
		data.put("openid", openid);
		JSONObject obj = JSONObject.fromObject(data);
		logger.info("获取用户身上的标签列表 方法执行前json参数---obj: "+obj.toString());
		JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
		Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
		if(error == null){
			JSONArray jsonArray = result.getJSONArray("tagid_list");
			list = JSONArray.toList(jsonArray, Integer.class);
		}
		logger.info("获取用户身上的标签列表 方法执行后json参数 : "+result.toString());
	}
	return list;
}
 
Example 4
Source File: ATLASUtil.java    From Criteria2Query with Apache License 2.0 5 votes vote down vote up
public static List<ConceptSet> getallConceptSet() {
	String strResult = HttpUtil.doGet(conceptseturl);
	JSONArray array = JSONArray.fromObject(strResult);
	// System.out.println("-->"+array);
	List<ConceptSet> list = JSONArray.toList(array, ConceptSet.class);// 过时方法
	return list;
}
 
Example 5
Source File: File.java    From xunxian with Apache License 2.0 5 votes vote down vote up
/**
	 * 自动扫货八卦灵石类加载数据
	 * <li>加载stone.xnx3文件,若是加载中数据出错,则自动使用默认数据data.Stone.stoneBak
	 */
	public void saoHuoStoneLoad(){
		Lang lang=new Func.Lang();
		try {
			String xnx3_content=new include.Module.TextFile().read(include.Command.thisFilePath+"\\config\\stone.xnx3", "UTF-8");
			xnx3_content=include.Module.UrlTransition.urlToUtf8(xnx3_content);
			JSONArray j=JSONArray.fromObject(xnx3_content);
			List l=j.toList(j);
//			List l=new Stone().stoneBak();
			SaoHuoFunc saoHuoFunc=new SaoHuoFunc();
			Command.JframeSaoHuo.stonejTable.removeAll();	//移除所有的重新添加
			DefaultTableModel tableModel=(DefaultTableModel) Command.JframeSaoHuo.stonejTable.getModel();
			Command.saoHuoStone.clear();		//情空,重新放入
			tableModel.getDataVector().clear();		//清空所有
			new Func.File().log("八卦灵石载入:"+l.size()+"条数据");
			for (int i = l.size()-1; i >-1; i--) {
				JSONArray jSub=JSONArray.fromObject(l.get(i));
				List lSub=jSub.toList(jSub);
//				System.out.println(jSub.get(0)+"-->"+jSub.get(1));
				String key=jSub.getString(0);
				int value=lang.Integer_(jSub.getString(1), 2);
				Command.saoHuoStone.put(key, value);
				Vector rowData = new Vector();
				rowData.add(key);
				rowData.add(saoHuoFunc.moneyToString(value));
				rowData.add(value);
				tableModel.insertRow(0, rowData);
				rowData=null;
			}
			saoHuoFunc=null;
			new Func.File().log("加载自动扫货八卦灵石类数据完毕");
		} catch (Exception e) {
			e.printStackTrace();
			new Func.Message().showMessageDialog("初始化失败!<br/>加载自动扫货八卦灵石类数据异常<br/>八卦灵石类数据已自动还原为初始数据");
//			Command.saoHuoStone=new Stone().stoneBak();
			new Func.File().log("加载自动扫货八卦灵石类数据异常!");
		}
		lang=null;
	}
 
Example 6
Source File: JsonLibJSONArrayIT.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Test
public void jsonToArrayTest() throws Exception {
    Method fromObject = JSONArray.class.getMethod("fromObject", Object.class);
    Method toArray = JSONArray.class.getMethod("toArray", JSONArray.class);
    Method toList = JSONArray.class.getMethod("toList", JSONArray.class);

    // JSONArray.toCollection() is added in json-lib 2.2. so check toCollection in JSONArray
    Method toCollection = null;
    try {
        toCollection = JSONArray.class.getMethod("toCollection", JSONArray.class);
    } catch (NoSuchMethodException ignored) {
    }

    String json = "[{'string':'JSON'}]";

    JSONArray jsonArray = JSONArray.fromObject(json);

    // JSONArray.toArray() of json-lib 2.0 and below have different return type. so we invoke it by reflection to avoid NoSuchMethodError
    toArray.invoke(null, jsonArray);

    JSONArray.toList(jsonArray);

    if (toCollection != null) {
        JSONArray.toCollection(jsonArray);
    }

    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();

    verifier.verifyTrace(event(SERVICE_TYPE, fromObject, annotation(ANNOTATION_KEY, json.length())));
    verifier.verifyTrace(event(SERVICE_TYPE, toArray));
    verifier.verifyTrace(event(SERVICE_TYPE, toList));
    
    if (toCollection != null) {
        verifier.verifyTrace(event(SERVICE_TYPE, toCollection));
    }

    verifier.verifyTraceCount(0);
}
 
Example 7
Source File: ConceptMapping.java    From Criteria2Query with Apache License 2.0 4 votes vote down vote up
public static List<ConceptSet> getallConceptSet() {
	String strResult = HttpUtil.doGet(conceptseturl);
	JSONArray array = JSONArray.fromObject(strResult);
	List<ConceptSet> list = JSONArray.toList(array, ConceptSet.class);
	return list;
}
 
Example 8
Source File: File.java    From xunxian with Apache License 2.0 4 votes vote down vote up
/**
	 * 自动扫货传奇配方类加载数据
	 * <li>加载legend.xnx3文件,若是加载中数据出错,则自动使用默认数据data.Legend()
	 */
	public void saoHuoLegendLoad(){
		Lang lang=new Func.Lang();
		Command.saoHuoLegend.clear();		//清空Map
		Command.saoHuoLegend=new data.Legend().legendBak();
		
		try {
			String xnx3_content=new include.Module.TextFile().read(include.Command.thisFilePath+"\\config\\legend.xnx3", "UTF-8");
			xnx3_content=include.Module.UrlTransition.urlToUtf8(xnx3_content);
			JSONArray j=JSONArray.fromObject(xnx3_content);
			List l=j.toList(j);
//			List l=new Pet().petBak();
			SaoHuoFunc saoHuoFunc=new SaoHuoFunc();
			Command.JframeSaoHuo.legendjTable.removeAll();	//移除所有的重新添加
			DefaultTableModel tableModel=(DefaultTableModel) Command.JframeSaoHuo.legendjTable.getModel();
			tableModel.getDataVector().clear();		//清空所有
			
			new Func.File().log("传奇配方载入:"+l.size()+"条数据");
			for (int i = l.size()-1; i >-1; i--) {
				JSONArray jSub=JSONArray.fromObject(l.get(i));
				List lSub=jSub.toList(jSub);
				String key=jSub.getString(0);
				int value=lang.Integer_(jSub.getString(1), 2);
				Command.saoHuoLegend.put(key, value);
			}
			
			Set<Map.Entry<String, Integer>> set = Command.saoHuoLegend.entrySet();
	        for (Iterator<Map.Entry<String, Integer>> it = set.iterator(); it.hasNext();) {
	            Map.Entry<String, Integer> entry = (Map.Entry<String, Integer>) it.next();
	            Vector rowData = new Vector();
				rowData.add(entry.getKey());
				rowData.add(saoHuoFunc.moneyToString(entry.getValue()));
				rowData.add(entry.getValue());
				tableModel.insertRow(0, rowData);
				rowData=null;
	        }
			
			saoHuoFunc=null;
			new Func.File().log("加载自动扫货传奇配方类数据完毕");
		} catch (Exception e) {
			e.printStackTrace();
		}
		lang=null;
	}
 
Example 9
Source File: File.java    From xunxian with Apache License 2.0 4 votes vote down vote up
/**
	 * 自动扫货风物志类加载数据
	 * <li>加载fengWuZhi.xnx3文件,若是加载中数据出错,则自动使用默认数据data.FengWuZhi()
	 */
	public void saoHuoFengWuZhiLoad(){
		Lang lang=new Func.Lang();
		Command.saoHuoFengWuZhi.clear();		//清空Map
		Command.saoHuoFengWuZhi=new data.FengWuZhi().fengWuZhiBak();
		
		try {
			String xnx3_content=new include.Module.TextFile().read(include.Command.thisFilePath+"\\config\\fengWuZhi.xnx3", "UTF-8");
			xnx3_content=include.Module.UrlTransition.urlToUtf8(xnx3_content);
			JSONArray j=JSONArray.fromObject(xnx3_content);
			List l=j.toList(j);
//			List l=new Pet().petBak();
			SaoHuoFunc saoHuoFunc=new SaoHuoFunc();
			Command.JframeSaoHuo.fengWuZhijTable.removeAll();	//移除所有的重新添加
			DefaultTableModel tableModel=(DefaultTableModel) Command.JframeSaoHuo.fengWuZhijTable.getModel();
			tableModel.getDataVector().clear();		//清空所有
			
			new Func.File().log("风物志载入:"+l.size()+"条数据");
			for (int i = l.size()-1; i >-1; i--) {
				JSONArray jSub=JSONArray.fromObject(l.get(i));
				List lSub=jSub.toList(jSub);
				String key=jSub.getString(0);
				int value=lang.Integer_(jSub.getString(1), 2);
				Command.saoHuoFengWuZhi.put(key, value);
			}
			
			Set<Map.Entry<String, Integer>> set = Command.saoHuoFengWuZhi.entrySet();
	        for (Iterator<Map.Entry<String, Integer>> it = set.iterator(); it.hasNext();) {
	            Map.Entry<String, Integer> entry = (Map.Entry<String, Integer>) it.next();
	            Vector rowData = new Vector();
				rowData.add(entry.getKey());
				rowData.add(saoHuoFunc.moneyToString(entry.getValue()));
				rowData.add(entry.getValue());
				tableModel.insertRow(0, rowData);
				rowData=null;
	        }
			
			saoHuoFunc=null;
			new Func.File().log("加载自动扫货风物志类数据完毕");
		} catch (Exception e) {
			e.printStackTrace();
		}
		lang=null;
	}
 
Example 10
Source File: File.java    From xunxian with Apache License 2.0 4 votes vote down vote up
/**
	 * 自动扫货宠物壳子类加载数据
	 * <li>加载pet.xnx3文件,若是加载中数据出错,则自动使用默认数据data.Pet.petBak
	 */
	public void saoHuoPetLoad(){
		Lang lang=new Func.Lang();
		Command.saoHuoPet.clear();		//清空Map
		Command.saoHuoPet=new data.Pet().petBak();
		
		try {
			String xnx3_content=new include.Module.TextFile().read(include.Command.thisFilePath+"\\config\\pet.xnx3", "UTF-8");
			xnx3_content=include.Module.UrlTransition.urlToUtf8(xnx3_content);
			JSONArray j=JSONArray.fromObject(xnx3_content);
			List l=j.toList(j);
//			List l=new Pet().petBak();
			SaoHuoFunc saoHuoFunc=new SaoHuoFunc();
			Command.JframeSaoHuo.petjTable.removeAll();	//移除所有的重新添加
			DefaultTableModel tableModel=(DefaultTableModel) Command.JframeSaoHuo.petjTable.getModel();
			tableModel.getDataVector().clear();		//清空所有
			
			new Func.File().log("宠物壳子载入:"+l.size()+"条数据");
			for (int i = l.size()-1; i >-1; i--) {
				JSONArray jSub=JSONArray.fromObject(l.get(i));
				List lSub=jSub.toList(jSub);
				String key=jSub.getString(0);
				int value=lang.Integer_(jSub.getString(1), 2);
				System.out.println("Key->"+key+"-->"+value);
				Command.saoHuoPet.put(key, value);
			}
			
			Set<Map.Entry<String, Integer>> set = Command.saoHuoPet.entrySet();
	        for (Iterator<Map.Entry<String, Integer>> it = set.iterator(); it.hasNext();) {
	            Map.Entry<String, Integer> entry = (Map.Entry<String, Integer>) it.next();
	            Vector rowData = new Vector();
				rowData.add(entry.getKey());
				rowData.add(saoHuoFunc.moneyToString(entry.getValue()));
				rowData.add(entry.getValue());
				tableModel.insertRow(0, rowData);
				rowData=null;
	        }
			
			saoHuoFunc=null;
			new Func.File().log("加载自动扫货宠物壳子类数据完毕");
		} catch (Exception e) {
			e.printStackTrace();
			new Func.Message().showMessageDialog("初始化失败!<br/>加载自动扫货宠物壳子类数据异常<br/>宠物壳子类数据已自动还原为初始数据");
//			Command.saoHuoStone=new Stone().stoneBak();
			new Func.File().log("加载自动扫货宠物壳子类数据异常!");
		}
		lang=null;
	}
 
Example 11
Source File: WeixinGzuserServiceImpl.java    From jeewx-boot with Apache License 2.0 4 votes vote down vote up
/**
 * 根据微信用户OpenId和微信公众号,获取微信用户的昵称等信息
 * @param openId
 * @param jwid
 * @param accessToken
 * @return
 */
@Override
public WeixinGzuser getGzUserInfo(String openId, String jwid, String accessToken) {
	if(accessToken == null) {
		return null;
	}
	String requestUrl = user_info_url.replace("ACCESS_TOKEN", accessToken);
	requestUrl = requestUrl.replace("OPENID", openId);
	JSONObject jsonObj = WeixinUtil.httpRequest(requestUrl, "GET", requestUrl);
	if(jsonObj != null && !jsonObj.containsKey("errcode")){
		System.out.println("-======jsonObj =+++" + jsonObj);
		WeixinGzuser userInfo = new WeixinGzuser();
		if (jsonObj.containsKey("nickname")) {
			userInfo.setNickname(jsonObj.getString("nickname"));
		}
		if(jsonObj.containsKey("sex")) {
			userInfo.setSex(jsonObj.getString("sex"));
		}
		if(jsonObj.containsKey("city")) {
			userInfo.setCity(jsonObj.getString("city"));
		}
		if(jsonObj.containsKey("province")) {
			userInfo.setProvince(jsonObj.getString("province"));
		}
		if(jsonObj.containsKey("country")) {
			userInfo.setCountry(jsonObj.getString("country"));
		}
		if(jsonObj.containsKey("headimgurl")) {
			userInfo.setHeadimgurl(jsonObj.getString("headimgurl"));
		}
		if(jsonObj.containsKey("subscribe_time")) {
			//update-begin--Author:zhangweijian  Date: 20180807 for:关注事件时间修改
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String subscribeTime = sdf.format(new Date(jsonObj.getLong("subscribe_time")*1000));
			userInfo.setSubscribeTime(subscribeTime);
			//update-end--Author:zhangweijian  Date: 20180807 for:关注事件时间修改
		}
		if(jsonObj.containsKey("groupid")) {
			userInfo.setGroupid(jsonObj.getString("groupid"));
		}
		if(jsonObj.containsKey("qr_scene")) {
			userInfo.setQrScene(jsonObj.getString("qr_scene"));
		}
		if(jsonObj.containsKey("qr_scene_str")) {
			userInfo.setQrSceneStr(jsonObj.getString("qr_scene_str"));
		}
		if(jsonObj.containsKey("language")) {
			userInfo.setLanguage(jsonObj.getString("language"));
		}
		if(jsonObj.containsKey("openid")) {
			userInfo.setOpenid(jsonObj.getString("openid"));
		}
		if(jsonObj.containsKey("subscribe")) {
			userInfo.setSubscribe(jsonObj.getString("subscribe"));
		}
		if(jsonObj.containsKey("subscribe_scene")) {
			userInfo.setSubscribeScene(jsonObj.getString("subscribe_scene"));
		}
		if(jsonObj.containsKey("remark")) {
			userInfo.setBzname(jsonObj.getString("remark"));
		}
		if(jsonObj.containsKey("unionid")) {
			userInfo.setUnionid(jsonObj.getString("unionid"));
		}
		if (jsonObj.containsKey("tagid_list")) {
			JSONArray tagJsonArr = jsonObj.getJSONArray("tagid_list");
			List<Integer> tagid_list = JSONArray.toList(tagJsonArr);
			//update-begin-zhangweijian-----Date:20180809---for:tagid_list非空判断
			if(tagid_list != null && tagid_list.size() > 0) {
				String tags = "";
				for (int i = 0; i < tagid_list.size(); i++) {
					tags += "," + tagid_list.get(i);
				}
				tags = tags.substring(1);
				userInfo.setTagidList(tags);
				//update-end-zhangweijian-----Date:20180809---for:tagid_list非空判断
			}
		}
		return userInfo;
	} else {
		log.info("-----------------getGzUserInfo--获取粉丝失败--------------------"+jsonObj.toString());
	}
	return null;
}
 
Example 12
Source File: JwMediaAPI.java    From jeewx-api with Apache License 2.0 4 votes vote down vote up
/**
 * 获取素材列表
 * 
 * @param accesstoken,type,offset,count
 * @param WxNews
 * @throws WexinReqException
 */
public static WxNews queryArticlesByMaterialNews(String accesstoken,String type,int offset,int count) throws WexinReqException {
	WxNews news = new WxNews();
	if (accesstoken != null) {
		String requestUrl = material_batchget_material_url.replace("ACCESS_TOKEN", accesstoken);
		
		JSONObject obj = new JSONObject();
		obj.put("type", type);
		obj.put("offset", offset);
		obj.put("count", count);
		JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
		if (result.has("errcode")&&result.getInt("errcode")!=0) {
			logger.error("=====获取素材列表失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg")+"=====");
			throw new WexinReqException(result.getString("errcode"));
		} else{
			logger.info("=====获取素材列表成功!result:"+result.toString()+"=====");
			JSONArray jsonArray = result.getJSONArray("item");
			Object[] itemArr = jsonArray.toArray();
			List<WxItem> wxItems = new ArrayList<WxItem>();
			for (int i = 0; i < itemArr.length; i++) {
				WxItem wxItem = new WxItem();
				Object itemObj = itemArr[i];
				JSONObject itemJson = JSONObject.fromObject(itemObj);
				String mediaId = itemJson.getString("media_id");
				Object newsItemObj = itemJson.get("content");
				JSONObject newsItemJson = JSONObject.fromObject(newsItemObj);
				JSONArray newsItemJsonArr = newsItemJson.getJSONArray("news_item");
				List<WxNewsArticle> wxArticleList = JSONArray.toList(newsItemJsonArr, WxNewsArticle.class);
				wxItem.setContents(wxArticleList);
				wxItem.setMedia_id(mediaId);
				if(itemJson.containsKey("name")){
					wxItem.setName("name");
				}
				wxItem.setUpdate_time(itemJson.getString("update_time"));
				wxItems.add(wxItem);
			}
			news.setItems(wxItems);
		}
	}
	return news;
}
 
Example 13
Source File: CleanHistoryData.java    From Criteria2Query with Apache License 2.0 4 votes vote down vote up
public List<Cohort> getallCohort() {
	String strResult = HttpUtil.doGet(cohorturl);
	JSONArray array = JSONArray.fromObject(strResult);
	List<Cohort> list = JSONArray.toList(array, Cohort.class);
	return list;
}
 
Example 14
Source File: JSONHelper.java    From jeewx-api with Apache License 2.0 3 votes vote down vote up
/***
 * 将对象转换为传入类型的List
 * 
 * @param <T>
 * @param jsonArray
 * @param objectClass
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> List<T> toList(Object object, Class<T> objectClass) {
	JSONArray jsonArray = JSONArray.fromObject(object);

	return JSONArray.toList(jsonArray, objectClass);
}
 
Example 15
Source File: CommonUtil.java    From ALLGO with Apache License 2.0 3 votes vote down vote up
/**
 * json To List<?>
 * 
 * @param jsonStr
 * @param objClass
 * @return
 */
@SuppressWarnings("deprecation")
public static List<?> toList(final String jsonStr, Class<?> objClass) {
	JSONArray jsArray = JSONArray.fromObject(jsonStr);
	List<?> list = JSONArray.toList(jsArray, objClass);
	return list;
}
 
Example 16
Source File: JSONHelper.java    From jeecg with Apache License 2.0 2 votes vote down vote up
/***
 * 将JSON对象数组转换为传入类型的List
 * 
 * @param <T>
 * @param jsonArray
 * @param objectClass
 * @return
 */
public static <T> List<T> toList(JSONArray jsonArray, Class<T> objectClass) {
	return JSONArray.toList(jsonArray, objectClass);
}
 
Example 17
Source File: JSONHelper.java    From jeecg with Apache License 2.0 2 votes vote down vote up
/***
 * 将对象转换为传入类型的List
 * 
 * @param <T>
 * @param jsonArray
 * @param objectClass
 * @return
 */
public static <T> List<T> toList(Object object, Class<T> objectClass) {
	JSONArray jsonArray = JSONArray.fromObject(object);

	return JSONArray.toList(jsonArray, objectClass);
}
 
Example 18
Source File: JSONHelper.java    From jeewx with Apache License 2.0 2 votes vote down vote up
/***
 * 将对象转换为传入类型的List
 * 
 * @param <T>
 * @param jsonArray
 * @param objectClass
 * @return
 */
public static <T> List<T> toList(Object object, Class<T> objectClass) {
	JSONArray jsonArray = JSONArray.fromObject(object);

	return JSONArray.toList(jsonArray, objectClass);
}
 
Example 19
Source File: JSONHelper.java    From jeewx with Apache License 2.0 2 votes vote down vote up
/***
 * 将JSON对象数组转换为传入类型的List
 * 
 * @param <T>
 * @param jsonArray
 * @param objectClass
 * @return
 */
public static <T> List<T> toList(JSONArray jsonArray, Class<T> objectClass) {
	return JSONArray.toList(jsonArray, objectClass);
}
 
Example 20
Source File: JSONHelper.java    From jeewx-api with Apache License 2.0 2 votes vote down vote up
/***
 * 将JSON对象数组转换为传入类型的List
 * 
 * @param <T>
 * @param jsonArray
 * @param objectClass
 * @return
 */
public static <T> List<T> toList(JSONArray jsonArray, Class<T> objectClass) {
	return JSONArray.toList(jsonArray, objectClass);
}