JSONObject result = JSONObject.parseObject(response); if(!"0".equals(result.getString("rtn"))){ return "错误"; }else{ for(Object jsonArray : result.getJSONArray("pair_results")){ TAlert tAlert = new TAlert(); JSONObject jsonObject = (JSONObject)jsonArray; JSONObject jsonDetail = JSONObject.parseObject(jsonObject.getString("hit_detail")); tAlert.setHitRecordId(jsonDetail.getString("hit_record_id")); JSONObject jsonResult1 = JSONObject.parseObject(jsonObject.getString("result1")); tAlert.setResult1cameraId(jsonResult1.getString("camera_id")); int a = tAlertMapper.insert(tAlert); //boolean b = itAlertService.save(tAlert); System.out.println(a); }
多层嵌套json解析
最新推荐文章于 2023-11-24 09:38:16 发布