简体   繁体   English

jackson ObjectMapper 忽略 JSON 中的反斜杠

[英]jackson ObjectMapper ignores backslash in JSON

I have such string value in my json:我的json中有这样的字符串值:

{
"number": "3111\/227\/005369",
}

I'm using ObjectMapper autoconfigured with Spring Boot and it ignores all of \\ This is the result of deserialized property i have:我正在使用通过 Spring Boot 自动配置的 ObjectMapper,它忽略了所有\\这是我拥有的反序列化属性的结果:

 number="3111/227/005369"

ObjectMapper totally ignore \\ ObjectMapper 完全忽略\\

This is my expectations of field String value:这是我对字段字符串值的期望:

number="3111\\/227\\/005369"

how may i solve this problem ?我该如何解决这个问题?

反斜杠是 JSON 中的转义字符,因此 JSON 也应该有双反斜杠才能按预期反序列化

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM