当前位置:网站首页>JSON parsing error special character processing (really speechless... Troubleshooting for a long time)
JSON parsing error special character processing (really speechless... Troubleshooting for a long time)
2022-07-05 12:37:00 【Hua Li Hu Shao】
There is a need. I'll give you one http The interface to It is used to save data transmitted from other interfaces
No problem ··
then There is an error in the adjustment org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error
Analyzing the problem is obviously First of all, I thought of the transmission json Is the format wrong Then let's go over there json I found a random one json Analyze the website No problem I know
And then I just Accept json String character string Self use gons analysis
I can't find out · The data format given is like this ··
Just this \ The problem of This hook 8 Given json The string is obviously not standardized That's bullshit There said no tojson Transferred It's a string json··· I'm a thief nm
Solution
use jackson Of ObjectMapper
ObjectMapper objectMapper = new ObjectMapper();
// Automatically handle backslashes
objectMapper.configure(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER,true);
// Because it's spelled out “json” So what else Space enter
// Special characters and escapes are allowed
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
// Allow to appear Single quotation marks
objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
边栏推荐
- Read and understand the rendering mechanism and principle of flutter's three trees
- MySQL view
- GPS數據格式轉換[通俗易懂]
- How can beginners learn flutter efficiently?
- MySQL stored procedure
- POJ-2499 Binary Tree
- Pytorch two-layer loop to realize the segmentation of large pictures
- 一款新型的智能家居WiFi选择方案——SimpleWiFi在无线智能家居中的应用
- MySQL trigger
- Understanding the architecture type of mobile CPU
猜你喜欢
Resnet18 actual battle Baoke dream spirit
Detailed structure and code of inception V3
Why learn harmonyos and how to get started quickly?
Preliminary exploration of basic knowledge of MySQL
MySQL index (1)
Take you hand in hand to develop a service monitoring component
MySQL storage engine
嵌入式软件架构设计-消息交互
UNIX socket advanced learning diary -ipv4-ipv6 interoperability
前几年外包干了四年,秋招感觉人生就这样了..
随机推荐
Pytorch two-layer loop to realize the segmentation of large pictures
Conversion du format de données GPS [facile à comprendre]
MySQL index (1)
Get the variable address of structure member in C language
Kotlin函数
ZABBIX customized monitoring disk IO performance
Pytoch through datasets Imagefolder loads datasets directly from files
NPM install reports an error
Preliminary exploration of basic knowledge of MySQL
Anaconda creates a virtual environment and installs pytorch
End to end neural network
Understanding the architecture type of mobile CPU
MySQL splits strings for conditional queries
Redis highly available slice cluster
Knowledge representation (KR)
Cypher syntax of neo4j graph database
Distributed solution - distributed lock solution - redis based distributed lock implementation
强化学习-学习笔记3 | 策略学习
MySQL multi table operation
Understand kotlin from the perspective of an architect