为什么post请求中的字符串字符串中包含无法请求的“{\">\””

时间:2021-05-12 16:51:44

标签: java spring spring-boot post

我在 post 请求中有一个字符串,其中包含信息

{
"itemCondition": "{\"and\":[{\"==\":[{\"var\":\"powerSwitch\"},\"1\"]},{\">\":[{\"var\":\"guardSensitivity\"},\"0\"]}]}"
}

但是中间的大于号比较符不能转义

错误信息如下

[org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ('\' (code 92)): expected a valid value (number, String, array, object, 'true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('\' (code 92)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
| at [Source: (PushbackInputStream); line: 1, column: 2]]  [WARN END]  

我不明白为什么 > 又被 == 代替了。我试过>、<、<=、>=,但是我无法实现请求,只有==成功

0 个答案:

没有答案