net域名做网站怎么样,建站公司 转型经验,自己做黑彩网站,网页站点的建立流程报错JsonParseException : Illegal unquoted character ((CTRL-CHAR, code 10)的解决方法
一、报错原因
我调用第三方接口获取返回的JSON数据时报上面的错误。原因是对方接口响应的JSON中包含特殊字符#xff0c;比如\n。当我们对这个JSON进行解析时就会报错JsonParseExcept…报错JsonParseException : Illegal unquoted character ((CTRL-CHAR, code 10)的解决方法
一、报错原因
我调用第三方接口获取返回的JSON数据时报上面的错误。原因是对方接口响应的JSON中包含特殊字符比如\n。当我们对这个JSON进行解析时就会报错JsonParseException : Illegal unquoted character ((CTRL-CHAR, code 10)。
二、解决方法
在解析JSON前设置下面配置
ObjectMapper objectMapper new ObjectMapper();
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
OtherMessage otherMessage objectMapper.readValue(text, OtherMessage.class);