报错:JSONException: illegal identifier : {pos 1, line 1, column 2{{"group":"trade_p0&qu

简介: 报错:JSONException: illegal identifier : {pos 1, line 1, column 2{{"group":"trade_p0&qu

报错:

com.alibaba.fastjson.JSONException: illegal identifier : {pos 1, line 1, 
column 2{{"group":"trade_p0",


原因分析:


查询后发现是因为我们使用fastjson来转换json格式数据时出错了。因为格式被破环,我们大部分的格式被破坏原因在于转义问题,比如我这里就是把双引号或单引号进行了转义,导致fastjson在解析时就会出错,当然也有原因可能是比如后端做了XSS攻击过滤。


解决:


把被破坏的格式再恢复回来:


string.replaceAll(""","\\\"");


当然我遇到了一种情况也是这个报错,但是利用replaceAll方法不管用,应该就不是转义的问题了,需要另寻出路

目录
相关文章
|
3月前
|
CDN
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
36 0
|
Java
Can&#39;t convert boolean to string automatically, because the &quot;boolean_format&quot; setting was &quot;true,false&quot;
五月 11, 2017 5:06:50 下午 freemarker.log._JULLoggerFactory$JULLogger error 严重: Error executing FreeMarker template FreeMarker template error: Can't con...
2777 0
|
数据库
Data truncation: Incorrect date value: ‘2022-11-28T16:00:00.000Z‘ for column ‘start_date‘ at row 1
Data truncation: Incorrect date value: ‘2022-11-28T16:00:00.000Z‘ for column ‘start_date‘ at row 1
261 0
|
数据库
Incorrect table definition; there can be only one auto column and it must be defined as a key
Incorrect table definition; there can be only one auto column and it must be defined as a key
175 0
Incorrect table definition; there can be only one auto column and it must be defined as a key
解决报错之 - error Identifier ‘attr_id‘ is not in camel case camelcase
解决报错之 - error Identifier ‘attr_id‘ is not in camel case camelcase
432 0
解决报错之 - error Identifier ‘attr_id‘ is not in camel case camelcase
|
XML 数据格式
XML问题: The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed
XML问题: The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed
196 0
|
自然语言处理
合同结构化文书解析失败,请联系管理员排查:{&quot;code&quot;:3001,&quot;message&quot;:&quot;File transform error&quot;,&quot;success&quot;:false,&quot;tracerId&quot;:&quot;requestId&quot;}报错处理
在使用自然语言处理自学习平台时,标注任务需要上传标注数据,但是使用doc格式上传文件后开始标注时出现了此提示,此篇文章简单介绍下此问题的处理方式。
719 0
合同结构化文书解析失败,请联系管理员排查:{&quot;code&quot;:3001,&quot;message&quot;:&quot;File transform error&quot;,&quot;success&quot;:false,&quot;tracerId&quot;:&quot;requestId&quot;}报错处理
|
XML Java 数据库连接
Open quote is expected for attribute "{1}" associated with an element type "id".
Open quote is expected for attribute "{1}" associated with an element type "id".
201 0
Open quote is expected for attribute "{1}" associated with an element type "id".
|
关系型数据库 MySQL 数据库
当你遇到Error: ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect string value:
当你遇到Error: ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect string value:
下一篇
无影云桌面