入参数据示例:
{
"respCode": "0000",
"respMsg": "请求成功",
"bizSeqNo": "22022120001184432418054888526616",
"transTime": "20220221180548",
"success": true,
"tokenArr": [
{
"value": "xxxx",
"expire_in": 96,
"expire_time": "20220221180724"
}
]
}
取出其中的value值
String req = "这里是入参";
//1.先转换成map
Map map = JSON.parseObject(req, Map.class);
//2.取出数组
JSONArray tokenArr = (JSONArray) map.get("tokenArr");
//3.把数组的第一个转换成map
HashMap tokenArrMap = JSON.parseObject(
tokenArr.getString(0), HashMap.class);
//4.取出value
String value = (String) tokenArrMap.get("value");