@RequestMapping(value = "/querySource.htm",method = RequestMethod.POST) public String init(HttpServletRequest request ) throws IOException { Map<String,String> map = new HashMap<String,String>(); Enumeration<?> fields = request.getParameterNames(); while(fields.hasMoreElements()) { String field = (String) fields.nextElement(); String[] values = request.getParameterValues(field); if (values.length > 1) map.put(field,values.toString()); else map.put(field,values[0]); } logger.info("***接口返回jsonArray:"+map.get("jsonArray")); if(map.get("jsonArray")!=null && map.get("jsonArray").length()>0){ String arrayStr = map.get("jsonArray"); List<PostAccountVO> postAccountVOList = new ArrayList<PostAccountVO>(); List<Map<String,String>> listObjectSec = JSONArray.parSEObject(arrayStr,List.class); Map<String,String> mapList = new HashMap<String,String>(); for(int i=0;i<listObjectSec.size();i++){ mapList = listObjectSec.get(i); JSONObject jsonObject = JSONObject.fromObject(mapList); PostAccountVO postAccountVO=(PostAccountVO)JSONObject.toBean(jsonObject,PostAccountVO.class); postAccountVOList.add(postAccountVO); } logger.info("接口jsonArray数据转对象:"+postAccountVOList); } }
对方是以http的方式访问我的就接口
@H_403_5@ 原文链接:https://www.f2er.com/json/288739.html