我正在使用spring RestTemplate将json反序列化为对象。我面临的挑战是json中的布尔值全都大写了。当我尝试反序列化它们时,我收到HttpMessageNotReadableException。
spring.springframework.http.converter.HttpMessageNotReadableException:JSON解析错误:无法从字符串“ FALSE”中反序列化
java.lang.Boolean
类型的值:仅识别为“ true”或“ false”;
所以我的问题是如何为此布尔值添加自定义映射。
ResponseEntity<List<myobject>> responseEntity = restTemplate.exchange(url,HttpMethod.GET,null,new ParameterizedTypeReference<List<myobject>>() {
});
return responseEntity.getBody();