JsonIgnoreProperties not working

后端 未结 4 1726
故里飘歌
故里飘歌 2021-01-07 17:54

I have the following simple class:

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@JsonIgnoreProperties({ \"thirdField\" })
public class Message          


        
4条回答
  •  -上瘾入骨i
    2021-01-07 18:22

    I found a Solution to this. Try to add

    @JsonSerialize(include= JsonSerialize.Inclusion.NON_EMPTY)
    

    About your class

    @JsonSerialize(include= JsonSerialize.Inclusion.NON_EMPTY)
    class ResponseModel {
     //your properties here
     @JsonIgnoreProperties("messageList","contactList","sender")
        var contactList= ArrayList()
    }
    

    That will solve your issue buddy.

提交回复
热议问题