当前位置:网站首页>com.alibaba.fastjson.JSONException: unclosed string
com.alibaba.fastjson.JSONException: unclosed string
2022-07-15 23:58:00 【欧阳小伙】
1、背景
最近做json解析的时候,突然出现了下面的异常,经检查发现是json中包含一些特殊转义字符,导致无法正常解析。出错的fastjson版本如下:
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.83'
2、解决方法
- 通过升级fastjson到最新版本解决,我升级到2.0.8的版本。
- 去除json中的特殊字符。
- 对json解析做一下异常捕获处理。
3、异常现象
fastjson出现如下异常:
com.alibaba.fastjson.JSONException: unclosed string : &
json字符串如下:
可以看到菜鸟教程中间有个\&符号。在使用fastjson的低版本时候报出了上面的异常。
{
边栏推荐
- Addition, deletion and modification of elements [DOM (II)]
- GO 读 yaml 的坑
- JDBC connection to mysql8.0 driver
- thinkphp5 读取多行文本、读取文件分割多行文本
- Autojs script notes
- mysql报错 1142 - SELECT command denied to user ‘dev‘@‘localhost‘ for table ‘user‘ (已解决)
- 02. Resttemplate learning notes
- I think software project management
- 【Flink】Flink Connection拒绝:localhost / 127.0.0.1:8081
- Analyse des produits secs | À l'ère du nuage public, comment monter et gérer le nuage? Cliquez sur inscription pour répondre à toutes les questions!
猜你喜欢

Redis_Linux安装

SQLyog无操作一段时间后重新操作会卡死问题(解决办法)

Shenzhen has launched a pilot project of online signing of construction contracts, and France has greatly contributed to building digitalization

Flink (I) overview

jol-core

02、RestTemplate学习笔记

Understand the common classification of software testing

无线通信安全作业2

Jol Core
![[stroll and brush questions] - reverse order string II](/img/a7/4b4880f0f73656b6d4968a081c285b.png)
[stroll and brush questions] - reverse order string II
随机推荐
曲伟海:坚持选择不放弃 是实现初心的法宝
[step on pit] attaching a row → dataframe
Experiment 3 servlet related technology
Precautions for using stoi function
PBFT简单介绍
Getting started with redis
How does wechat applet realize pull-down refresh?
Shutter ShowDialog Popup
Autojs script notes
无线通信安全作业2
Power system unit commitment (realized by matlab code)
What is the once brilliant streaming media protocol RTMP? Can it be completely replaced? Yiwen takes you into the world of RTMP
openpcdet之pointpillar代码阅读——第一篇:数据增强与数据处理
Redis_Linux安装
Flink(二)时间和窗口
[unity3d] toggle of ugui
(manual) [sqli labs44, 45] post character injection, blind injection, Stack Injection
Torch 常用 Tricks 总结
Two bytes, carried out by the interviewer and shared with everyone
【踩坑】Appending a row → DataFrame