报错: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方法不管用,应该就不是转义的问题了,需要另寻出路

目录
相关文章
|
Java
Can't convert boolean to string automatically, because the "boolean_format" setting was "true,false"
五月 11, 2017 5:06:50 下午 freemarker.log._JULLoggerFactory$JULLogger error 严重: Error executing FreeMarker template FreeMarker template error: Can't con...
2801 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
291 0
|
SQL 关系型数据库 MySQL
near ‘order values(‘1‘,‘1‘,‘100‘,‘10.25‘)‘ at line 1
near ‘order values(‘1‘,‘1‘,‘100‘,‘10.25‘)‘ at line 1
97 0
|
XML 数据格式
XML问题: The processing instruction target matching "[xX][mM][lL]" is not allowed
XML问题: The processing instruction target matching "[xX][mM][lL]" is not allowed
238 0
|
自然语言处理
合同结构化文书解析失败,请联系管理员排查:{"code":3001,"message":"File transform error","success":false,"tracerId":"requestId"}报错处理
在使用自然语言处理自学习平台时,标注任务需要上传标注数据,但是使用doc格式上传文件后开始标注时出现了此提示,此篇文章简单介绍下此问题的处理方式。
765 0
合同结构化文书解析失败,请联系管理员排查:{"code":3001,"message":"File transform error","success":false,"tracerId":"requestId"}报错处理
成功解决ValueError: Number of passed names did not match number of header fields in the file
成功解决ValueError: Number of passed names did not match number of header fields in the file
SAP WM Movement Type 里的‘Ref.Stor.Type Search’字段用法初探
SAP WM Movement Type 里的‘Ref.Stor.Type Search’字段用法初探
SAP WM Movement Type 里的‘Ref.Stor.Type Search’字段用法初探
|
关系型数据库 MySQL
1293 - Incorrect table definition; there can be only oneTIMESTAMP column with CURRENT_TIMESTAMP
一个表中出现多个timestamp并设置其中一个为current_timestamp的时候经常会遇到 1293 - Incorrect table definition; there can be only oneTIME...
2502 0