JSON取别名/返回不为空的数据

Json 序列化的三种方式:spa

1.Gsoncode

@SerializedName("idcard")
private String idcardNo;


2.fastJsonblog

@JSONField(name="idcard")
private String idcardNo;

 

3.JackSonast

@JsonProperty("idcard")
private String idcardNo;

 

 

 类上进行判断返回值数据不为空的属性 JsonInclude.Include.NON_NULLclass

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Test {
   private String name;
  
   private int age;      
}
相关文章
相关标签/搜索