解析接口返回的json数组

json串:

{
    "message": "成功",
    "hasMore": false,
    "result": 1,
    "count": 3,
    "records": [
        [
            "72,064",
            "项目主审",
            "[00758]曾勇华",
            "2020-09-08 09:53:00",
            "2020-09-08 09:53:05",
            "提交",
            null,
            "已完成",
            "3",
            "0",
            "0"
        ],
        [
            "72,065",
            "判断流程类型",
            null,
            "2020-09-08 09:53:00",
            "2020-09-08 09:53:05",
            "自动[default_action]",
            null,
            "已完成",
            "7",
            "0",
            "0"
        ],
        [
            "72,066",
            "部门负责人",
            "[00024]秦晋昭",
            "2020-09-08 09:53:05",
            null,
            null,
            null,
            "处理中",
            "8",
            "0",
            "1"
        ]
    ],
    "queryId": "",
    "metaData": {
        "colInfo": [
            {
                "scale": 0,
                "name": "ID",
                "length": 12,
                "label": "StepID",
                "type": 1
            },
            {
                "scale": 0,
                "name": "StepName",
                "length": 60,
                "label": "步骤",
                "type": 0
            },
            {
                "scale": 0,
                "name": "Caller",
                "length": 100,
                "label": "处理人",
                "type": 0
            },
            {
                "scale": 0,
                "name": "StartTime",
                "length": 16,
                "label": "开始时间",
                "type": 3
            },
            {
                "scale": 0,
                "name": "FinishTime",
                "length": 16,
                "label": "结束时间",
                "type": 3
            },
            {
                "scale": 0,
                "name": "ActionName",
                "length": 60,
                "label": "执行动作",
                "type": 0
            },
            {
                "scale": 0,
                "name": "Summary",
                "length": 200,
                "label": "摘要信息",
                "type": 0
            },
            {
                "scale": 0,
                "name": "Status",
                "length": 60,
                "label": "处理状态",
                "type": 0
            },
            {
                "scale": 0,
                "name": "STEP_ID",
                "length": 12,
                "label": "STEP_ID",
                "type": 1
            },
            {
                "scale": 0,
                "name": "EXTEND_ACTIVITY_ID",
                "length": 12,
                "label": "EXTEND_ACTIVITY_ID",
                "type": 1
            },
            {
                "scale": 0,
                "name": "RUNNING",
                "length": 12,
                "label": "RUNNING",
                "type": 1
            }
        ],
        "colCount": 11
    }
}

解析json串数组代码

		Gson gson = new Gson();
		Map o = gson.fromJson(result, Map.class);
		System.out.println(o.get("records"));
		List<List<String>> records = (List<List<String>>) o.get("records");
		List<Map<String, Object>> mapList = new ArrayList<>();
		for (List<String> record : records) {
			Map<String, Object> map = new HashMap<>(16);
			map.put("stepName", record.get(1));
			map.put("dealer", record.get(2));
			map.put("startTime", record.get(3));
			map.put("finishTime", record.get(4));
			map.put("actionName", record.get(5));
			map.put("summary", record.get(6));
			map.put("status", record.get(7));
			mapList.add(map);
		}
		
		System.out.println(mapList);

在这里插入图片描述
需要用到以上几个jar包依赖

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值