Error while extracting response for type [class XXXXX] and content type [text/html;charset=UTF-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ('\u003c' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('\u003c' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

正常情况下,接口调用应当返回正确数据的json格式,并且返回的数据中确定不包含小于符号 < ,但是偏偏就出现了解析数据中有小于符号的情况,百思不得解。

正确的content type应当为:application/json

而上述错误中报content type 为:text/html

经过分析得知出现改问题的答案为:调用接口过程中被认证程序拦截了,也就是调用接口的时候Token过期,于是返回了错误页面,错误页面是一个html页面,或者被强制跳转到了登录页面,html页面的content type 为:text/html ,html 页面的数据开头:<!DOCTYPE html>

如果你遇到了解析json 个数数据时候出现这种莫名奇妙是错误,那很可能也是这种原因

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐