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

目录
相关文章
|
5月前
Error:Expected linebreaks to be ‘LF‘ but found ‘CRLF‘ linebreak-style
Error:Expected linebreaks to be ‘LF‘ but found ‘CRLF‘ linebreak-style
|
7月前
|
人工智能 自然语言处理 语音技术
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
52 0
|
11月前
error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
95 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
146 0
|
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...
2727 0
|
自然语言处理
合同结构化文书解析失败,请联系管理员排查:{"code":3001,"message":"File transform error","success":false,"tracerId":"requestId"}报错处理
在使用自然语言处理自学习平台时,标注任务需要上传标注数据,但是使用doc格式上传文件后开始标注时出现了此提示,此篇文章简单介绍下此问题的处理方式。
614 0
合同结构化文书解析失败,请联系管理员排查:{"code":3001,"message":"File transform error","success":false,"tracerId":"requestId"}报错处理
|
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".
154 0
Open quote is expected for attribute "{1}" associated with an element type "id".
OPA 13 - ok(oButton,"find the Create button");
Created by Wang, Jerry, last modified on Nov 08, 2015
101 0
OPA 13 - ok(oButton,"find the Create button");