今天在postman调接口的时候出错了,出错信息为:
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('c' (code 99)): was expecting comma to separate Object entries
at [Source: (PushbackInputStream); line: 1, column: 56]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1840)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:712)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:637)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextFieldName(UTF8StreamJsonParser.java:1010)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:376)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:369)
... 61 common frames omitted
看了好多帖子居然还没有找到错误,最后只能求助我的同事(小声bb:还是自己太菜了)
postman的数据是从这里拿到的⬇️
拿到的数据这这个样子的:
{"applyType":"aaa","applyData":{"approveHtml":"{"content":"申请成为xxxx"}","zoneList":[null],"systemRoleList":[],"adminIdList":[132]},"applyComment":""}
从浏览器拿到的是这样子的
{"applyType":"aaa","applyData":{"approveHtml":"{\"content\":\"申请成为xxx \"}","zoneList":[null],"systemRoleList":[],"adminIdList":[132]},"applyComment":""}
原因:Chrome 的 copy as cURL的一大坑点,他拿到的数据好像是会自动给你解析一下,去掉\
解决办法:把从浏览器里拿到的数据也就是这个带\的,替换postman里的入参,就解决了