Jackson: Ignore Json configuration value

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

I have the following json file:


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


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 07:34

    You can use annotation @JsonIgnoreProperties; if it's just one value you want to skip, something like:

    @JsonIgnoreProperties({"externalId"})
    

    or to ignore anything that can't be used:

    @JsonIgnoreProperties(ignoreUnknown=true)
    

    There are other ways to do it too, for rest check out FasterXML Jackson wiki.

提交回复
热议问题