@RequestMapping(value={"/sysOrgRest/getInfoByOrgIds"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) public void getInfoByOrgIds(@RequestBody String param) { try { log.info("before param is {}",param); if(param.contains("\"")) { param = org.apache.commons.lang.StringEscapeUtils.unescapeJava(param); param= param.replaceFirst("\"", ""); param= param.substring(0,param.length()-1); } log.info("after param is {}",param); JSONObject object = JSONObject.parseObject(param); if (object.containsKey("enterpriseid") && object.containsKey("orgIds")) { ListorgIds = (List ) object.get("orgIds"); Integer enterpriseid = (Integer) object.get("enterpriseid"); } } catch (Exception e) { log.error(e.getMessage(), e); }
commons-lang commons-lang 2.6
13:39:32.393 expressLog [http-nio-8889-exec-2] DEBUG o.s.w.s.m.m.a.RequestResponseBodyMethodProcessor - Read "application/json;charset=UTF-8" to [""{\"orgIds\":[477,476,261,1,13],\"enterpriseid\":1}""]
13:39:32.394 expressLog [http-nio-8889-exec-2] INFO com.paic.express.rest.test - before param is "{\"orgIds\":[477,476,261,1,13],\"enterpriseid\":1}" 转义了。13:39:35.576 expressLog [http-nio-8889-exec-2] INFO com.paic.express.rest.test - after param is {"orgIds":[477,476,261,1,13],"enterpriseid":1} 解决