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;      
}
相關文章
相關標籤/搜索