JSONObject jsonObject
= JSONObject
.parseObject(body
);
JSONArray jsonArray
= new JSONArray();
Object object
= jsonObject
.get("msg");
if(object
instanceof JSONObject) {
jsonArray
.add(object
);
} else if(object
instanceof JSONArray) {
jsonArray
= jsonObject
.getJSONArray("msg");
}
String type
= jsonArray
.getJSONObject(0).get("type").toString();
String imei
= jsonArray
.getJSONObject(0).get("imei").toString();
List
<OneNetMsgVo> msgVos
= JSONObject
.parseArray(jsonArray
.toJSONString(), OneNetMsgVo
.class);
OneNetEventVo eventVo
= JSONObject
.parseObject(jsonArray
.getString(0), OneNetEventVo
.class);
转载请注明原文地址:https://tech.qufami.com/read-7699.html