当前位置:网站首页>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);
边栏推荐
- Xi IO flow
- struct MySQL
- Sqoop import and export operation
- Get the variable address of structure member in C language
- Take you two minutes to quickly master the route and navigation of flutter
- Detailed steps for upgrading window mysql5.5 to 5.7.36
- July Huaqing learning-1
- Learn JVM garbage collection 02 - a brief introduction to the reference and recycling method area
- PXE startup configuration and principle
- JDBC -- extract JDBC tool classes
猜你喜欢

Redis highly available sentinel mechanism

Matlab struct function (structure array)

Interviewer: is acid fully guaranteed for redis transactions?

Learn the memory management of JVM 02 - memory allocation of JVM

Understand redis persistence mechanism in one article

Select drop-down box realizes three-level linkage of provinces and cities in China

Pytoch uses torchnet Classerrormeter in meter

Ecplise development environment configuration and simple web project construction

Making and using the cutting tool of TTF font library

Principle of universal gbase high availability synchronization tool in Nanjing University
随机推荐
UNIX socket advanced learning diary - advanced i/o functions
Keras implements verification code identification
GPS data format conversion [easy to understand]
Redis's memory elimination mechanism, read this article is enough.
How to recover the information server and how to recover the server data [easy to understand]
Pytoch counts the number of the same elements in the tensor
POJ-2499 Binary Tree
Hexadecimal conversion summary
PIP command reports an error pip is configured with locations that requires tls/ssl problems
Master-slave mode of redis cluster
The evolution of mobile cross platform technology
Programming skills for optimizing program performance
MySQL data table operation DDL & data type
嵌入式软件架构设计-消息交互
Principle of universal gbase high availability synchronization tool in Nanjing University
GNN(pytorch-geometric)
byte2String、string2Byte
MySQL basic operation -dql
前几年外包干了四年,秋招感觉人生就这样了..
ZABBIX monitors mongodb templates and configuration operations