博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
feign传输String json串 自动转义 \ 解决方法
阅读量:4706 次
发布时间:2019-06-10

本文共 1570 字,大约阅读时间需要 5 分钟。

@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")) {
List
orgIds = (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}     解决

转载于:https://www.cnblogs.com/hsq666666/p/11320657.html

你可能感兴趣的文章
k8s-高级调度方式-二十一
查看>>
[HDU3555]Bomb
查看>>
基于dubbo的分布式系统(一)安装docker
查看>>
Recursion
查看>>
66. Plus One
查看>>
COMP30023 Computer Systems 2019
查看>>
CSS选择器分类
查看>>
Kali学习笔记39:SQL手工注入(1)
查看>>
C# MD5加密
查看>>
Codeforces Round #329 (Div. 2)D LCA+并查集路径压缩
查看>>
移动应用开发测试工具Bugtags集成和使用教程
查看>>
Java GC、新生代、老年代
查看>>
Liferay 6.2 改造系列之十一:默认关闭CDN动态资源
查看>>
多线程
查看>>
折线切割平面
查看>>
获取当前路径下的所有文件路径 :listFiles
查看>>
图像形态学及更通用的形态学的原理及细节汇总
查看>>
linux开启coredump的3种方法
查看>>
数据驱动之 python + requests + Excel
查看>>
小鸡啄米问题求解
查看>>