当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.getJSONArray方法代码示例

本文整理汇总了Java中com.alibaba.fastjson.JSONObject.getJSONArray方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.getJSONArray方法的具体用法?Java JSONObject.getJSONArray怎么用?Java JSONObject.getJSONArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.fastjson.JSONObject的用法示例。


在下文中一共展示了JSONObject.getJSONArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryBranch

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/** 查询支行信息 */
public JSONArray queryBranch(LianlianBankType bankType, String cityCode) {
	JSONObject post = new JSONObject();
	post.put("oid_partner", this.merchantId);
	post.put("sign_type", this.signType);
	post.put("card_no", "");
	post.put("bank_code", bankType.getCode());
	post.put("brabank_name", "银行");// 关键字
	post.put("city_code", cityCode);
	// 加签名
	String sign = LianlianPayUtil.addSign(post, this.privateKey, this.md5Key);
	post.put("sign", sign);
	String text = this.sendHttpPost(this.queryUrl, post.toString());
	logger.info("连连支付返回:" + text);

	JSONObject result = JSONObject.parseObject(text);
	if (!"0000".equals(result.getString("ret_code"))) {
		return null;
	}
	return result.getJSONArray("card_list");
}
 
开发者ID:yi-jun,项目名称:aaden-pay,代码行数:22,代码来源:LianlianClient.java

示例2: getTags

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public static List<Tag> getTags (boolean useCache) throws APIException {
    if (DEBUG) Log.i(TAG, "-> getTags");
    try {
        String text = NetworkUtil.get(ApiManager.API_TAGS, useCache);
        if (DEBUG) Log.i(TAG, "-> get -> success");
        JSONObject root = JSON.parseObject(text);
        JSONArray data = root.getJSONArray("data");
        List<Tag> tags = new ArrayList<>();
        for (int i = 0; i < data.size(); i ++) {
            JSONObject object = data.getJSONObject(i);
            Tag tag = getTag(object.getInteger("id"), object);
            if (DEBUG) Log.i(TAG, "Adding " + tag.toString());
            tags.add(tag);
        }
        return tags;
    } catch (IOException|JSONException e) {
        throw new APIException(e);
    }
}
 
开发者ID:ProjectFishpond,项目名称:TPondof,代码行数:20,代码来源:TagManager.java

示例3: getObject

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
 * read the json file and transform into memory
 *
 * @return
 * @throws Exception
 */
public Map<String, Map<String, String>> getObject() throws Exception {
    Map<String, Map<String, String>> result = new ConcurrentHashMap<String, Map<String, String>>();
    String jsonString = readFromFile();
    JSONArray jsonArray = JSONObject.parseArray(jsonString);
    if (jsonArray != null) {
        for (Object schema : jsonArray) {
            JSONObject x = (JSONObject) schema;
            String schemaName = x.getString("schema");
            JSONArray viewList = x.getJSONArray("list");
            Map<String, String> schemaView = new ConcurrentHashMap<String, String>();
            for (Object view : viewList) {
                JSONObject y = (JSONObject) view;
                schemaView.put(y.getString("name"), y.getString("sql"));
            }
            result.put(schemaName, schemaView);
        }
    }
    return result;
}
 
开发者ID:actiontech,项目名称:dble,代码行数:26,代码来源:FileSystemRepository.java

示例4: processTypeResult

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
 * 对返回值进行处理
 * @param str
 * @return text
 */
public String processTypeResult(String str){
	System.out.println("textTypeResult:"+str);
	JSONObject jsonObject = JSONObject.parseObject(str);
	String code = jsonObject.getString("code");
	if(TEXT_CODE.equals(code)){
		return jsonObject.getString("text");
	}else if(LINK_CODE.equals(code)){
		return jsonObject.getString("text")+"\n"+jsonObject.getString("url");
	} else if (NEWS_CODE.equals(code)) {
		JSONArray array = jsonObject.getJSONArray("list");
		int size = 5;
		if (array.size() < 5) {
			size = array.size();
		}
		List<Article> list = new ArrayList<>();
		for (int i = 0; i < size; i++) {
			JSONObject object = array.getJSONObject(i);
			Article article = new Article(object.getString("article"), object.getString("source"), object.getString("icon"), object.getString("detailurl"));
			list.add(article);
		}
		return list.toString();
	}else{
		return "对不起,没听清楚,再说一遍吧。";
	}
}
 
开发者ID:CharleyXu,项目名称:tulingchat,代码行数:31,代码来源:TulingRobotUtil.java

示例5: playUrl

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@RequestMapping(value = "playUrl", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ReturnT<JSONArray> playUrl(Model model, HttpServletRequest request, @RequestParam("uid") String uid) {
    HeadPrinter.printHead(model);
    JSONObject jsonObject1 = JSONObject.parseObject(uid);
    long id = jsonObject1.getLongValue("uid");
    String result = NetEaseClient.getPlayUrl(id);
    JSONObject jsonObject = JSONObject.parseObject(result);
    String ly = "";
    JSONArray jsonArray = jsonObject.getJSONArray("data");
    return new ReturnT(jsonArray, ly);
}
 
开发者ID:wxz1211,项目名称:dooo,代码行数:13,代码来源:NetEaseController.java

示例6: test_for_issue

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public void test_for_issue() throws Exception {
    String text = "{\"resultObj\":{\"assetSize\":{},\"chargeTypeList\":[\"A\"],\"fundManagerMapList\":[{},{}],\"fundRateConvertList\":[{},{},{}],\"fundRateOperate\":{},\"fundRatePurchaseList\":[{\"fixedRate\":{},\"maxAmount\":{},\"minAmount\":{}}],\"fundRateRedeemList\":[{\"fixedRate\":{}}],\"fundRateSubscribeList\":[{\"fixedRate\":{},\"maxAmount\":{},\"minAmount\":{}}],\"fundRatingList\":[{},{}],\"fundRuleConvertList\":[{},{}],\"fundRuleConvertVoList\":[{\"fundRateConvertList\":[{\"$ref\":\"$.resultObj.fundRateConvertList[0]\"},{\"$ref\":\"$.resultObj.fundRateConvertList[1]\"}],\"fundRuleConvert\":{\"$ref\":\"$.resultObj.fundRuleConvertList[0]\"}},{\"fundRateConvertList\":[{\"$ref\":\"$.resultObj.fundRateConvertList[2]\"}],\"fundRuleConvert\":{\"$ref\":\"$.resultObj.fundRuleConvertList[1]\"}}]}}";
    JSONObject root = JSON.parseObject(text);

    JSONObject resultObj = root.getJSONObject("resultObj");
    assertNotNull(resultObj);

    JSONArray fundRuleConvertVoList = resultObj.getJSONArray("fundRuleConvertVoList");
    assertNotNull(fundRuleConvertVoList);

    JSONArray fundRateConvertList = fundRuleConvertVoList.getJSONObject(0).getJSONArray("fundRateConvertList");
    assertNotNull(fundRateConvertList);

    assertNotNull(fundRateConvertList.get(0));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:Alipay1213.java

示例7: getBaseUnitTagMap

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public Map<String, String> getBaseUnitTagMap() throws IOException {
    Map<String, String> tagMap = new HashMap<>();
    if (null != this.apContext.getApExploredFolder()
        && this.apContext.getApExploredFolder().exists()) {
        File file = new File(this.apContext.getApExploredFolder(), "atlasFrameworkProperties.json");
        if (file.exists()) {
            JSONObject jsonObject = (JSONObject)JSON.parse(org.apache.commons.io.FileUtils.readFileToString(file));
            JSONArray jsonArray = jsonObject.getJSONArray("bundleInfo");
            for (JSONObject obj : jsonArray.toArray(new JSONObject[0])) {
                tagMap.put(obj.getString("pkgName"), obj.getString("unique_tag"));
            }
        }
    }
    return tagMap;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:16,代码来源:AppVariantContext.java

示例8: onEvent

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@Override
public void onEvent(CustomNotification customNotification) {
    try {
        JSONObject jsonObject = parseContentJson(customNotification);
        // 收到群视频邀请
        if (isTeamAVChatInvite(jsonObject)) {
            final String roomName = jsonObject.getString(KEY_RID);
            final String teamId = jsonObject.getString(KEY_TID);
            JSONArray accountArray = jsonObject.getJSONArray(KEY_MEMBER);
            final ArrayList<String> accounts = new ArrayList<>();
            final String teamName = jsonObject.getString(KEY_TNAME);
            if (accountArray != null) {
                for (Object o : accountArray) {
                    accounts.add((String) o);
                }
            }

            // 接收到群视频邀请,启动来点界面
            LogUtil.ui("receive team video chat notification " + teamId + " room " + roomName);
            if (isTeamAVChatting || AVChatProfile.getInstance().isAVChatting()) {
                LogUtil.ui("cancel launch team av chat isTeamAVChatting = " + isTeamAVChatting);
                Toast.makeText(DemoCache.getContext(), "正在进行视频通话", Toast.LENGTH_SHORT).show();
                return;
            }
            LogUtil.ui("isSyncComplete = " + isSyncComplete);
            if (isSyncComplete || !checkOfflineOutTime(customNotification)) {
                isTeamAVChatting = true;
                launchActivity(teamId, roomName, accounts, teamName);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:35,代码来源:TeamAVChatHelper.java

示例9: test_jsonpath

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public void test_jsonpath() throws Exception {
    JSONObject rootObject = JSON.parseObject("{\"array\":[{},{},{},{}]}");
    JSONPath.set(rootObject, "$.array[0:].key", "123");

    JSONArray array = rootObject.getJSONArray("array");
    for (int i = 0; i < array.size(); ++i) {
        Assert.assertEquals("123", array.getJSONObject(i).get("key"));
    }
    System.out.println(rootObject);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:JSONPath_set_test2.java

示例10: uncompactArrayFormat

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
private JSONArray uncompactArrayFormat(JSONObject jsonValue) {
    val head = jsonValue.getJSONArray("_h");
    val data = jsonValue.getJSONArray("_d");
    int arraySize = data.size() / head.size();
    val uncompacted = new JSONArray(arraySize);
    for (int i = 0; i < arraySize; i++) {
        val item = new JSONObject(head.size());
        uncompacted.add(item);

        for (int j = 0, jj = head.size(); j < jj; ++j)
            item.put(head.getString(j), data.get(i * jj + j));
    }

    return uncompacted;
}
 
开发者ID:bingoohuang,项目名称:westjson,代码行数:16,代码来源:WestJsonUncompacter.java

示例11: test_parseMileage

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@Test
public void test_parseMileage() {
    File file = new File("D:\\mileage.json");
    String json = readToString(file, "UTF-8");
    JSONObject jsonObject = JSON.parseObject(json);
    JSONObject data = jsonObject.getJSONObject("data");
    JSONArray dataArray = data.getJSONArray("result");
    double result = 0;
    for (int i = 0; i < dataArray.size(); i++) {
        JSONObject temp = JSON.parseObject(dataArray.get(i).toString());
        System.out.println("carNumber:"+temp.get("carNumber")+",mileage:"+temp.get("mileage"));
        result += Double.parseDouble(temp.get("mileage").toString());
    }
    System.out.println(result);
}
 
开发者ID:alamby,项目名称:upgradeToy,代码行数:16,代码来源:ParseMileage.java

示例12: getDataJSONArray

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
 * 返回列表数据, 反之返回空.
 * 
 * @return
 */
public JSONArray getDataJSONArray()
{
	if (data != null)
	{
		JSONObject jsonObject = JSONObject.parseObject(data);
		return jsonObject.getJSONArray("list");
	}

	return null;
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:16,代码来源:Res.java

示例13: currentNodeInfo

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
 * 当前节点的节点信息监控数据
 * @param rabbitMQ
 * @param nodeName
 * @return
 */
private List<DetectResult.Metric> currentNodeInfo(RabbitMQ rabbitMQ, String nodeName) {
    List<DetectResult.Metric> result = new ArrayList<>();
    String apiBody = getAPIResult(rabbitMQ,"api/nodes/" + nodeName);
    if (apiBody != null){
        JSONObject jsonObject = JSONObject.parseObject(apiBody);
        utilForParsingJSON(result,"fd_total","fd_total",jsonObject,CounterType.GAUGE,"");
        utilForParsingJSON(result,"mem_used","mem_used",jsonObject,CounterType.GAUGE,"");
        utilForParsingJSON(result,"sockets_used","sockets_used",jsonObject,CounterType.GAUGE,"");
        utilForParsingJSON(result,"run_queue","run_queue",jsonObject,CounterType.GAUGE,"");
        JSONArray partitions = jsonObject.getJSONArray("partitions");
        result.add(new DetectResult.Metric("partitions",String.valueOf(partitions.size()),CounterType.GAUGE,""));
    }
    return result;
}
 
开发者ID:DevopsJK,项目名称:SuitAgent,代码行数:21,代码来源:RabbitMQPlugin.java

示例14: getLatestNews

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
 * 最新
 */
public List<Article> getLatestNews() {
	String request = HttpClientUtil.sendGet(latestUrl, null, null);
	JSONObject jsonObject = JSONObject.parseObject(request);
	JSONArray top_stories = jsonObject.getJSONArray("top_stories");
	return getNewsListFromJsonArray(top_stories);
}
 
开发者ID:CharleyXu,项目名称:tulingchat,代码行数:10,代码来源:DailyZhihuUtil.java

示例15: test_for_issue

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public void test_for_issue() throws Exception {
    String json = "{value:[\"null\"]}";
    JSONObject parse = JSONObject.parseObject(json);
    JSONArray jsonArray = parse.getJSONArray("value");
    Assert.assertEquals(1, jsonArray.size());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:Bug_for_issue_434.java


注:本文中的com.alibaba.fastjson.JSONObject.getJSONArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。