1. 程式人生 > >Jackson 反序列化時 大小寫不敏感設定

Jackson 反序列化時 大小寫不敏感設定

常用配置
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(Feature.IGNORE_UNKNOWN,true);
objectMapper.configure(Feature.WRITE_BIGDECIMAL_AS_PLAIN,true);
objectMapper.configure(JsonParser.Feature.ALLOW_MISSING_VALUES,true);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES,false);//大小寫脫敏 預設為false  需要改為true

參考

com.fasterxml.jackson.databind.MapperFeature#ACCEPT_CASE_I