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包依赖