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);
jsonString转实体类
最新推荐文章于 2023-03-03 15:16:31 发布