Jackson: Ignore Json configuration value

后端 未结 2 1525
夕颜
夕颜 2020-12-13 06:41

I have the following json file:


{
  \"segments\": {        
            \"externalId\": 123, 
            \"name\": \"Tomas Zulberti\", 
            \"shoul         


        
2条回答
  •  感动是毒
    2020-12-13 07:16

    Also we can use mapper.enable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES); instead @JsonIgnoreProperties(ignoreUnknown=true)

    but for particular property we can use

    @JsonIgnoreProperties({"externalId"})
    public class Segment {
    
        private String id;
        private String name;
        private boolean shouldInform;
    
        // getter and setters here...
    }
    

提交回复
热议问题