-
作用相同:让字段不会参与JSON与Java 对象的序列化和反序列化
-
作用位置不同
@JsonIgnore 注解作用在类的属性上
@JsonIgnore @JSONField(name = "userName")
@JsonIgnoreProperties 注解作用在类上,内部可以写多个属性
@JsonIgnoreProperties({"date","username"})
public class User {
@JSONField(name = "userName")
private String username;
@JSONField(name = "passWord",serialzeFeatures = SerializerFeature.WriteMapNullValue)
private int password;
@JSONField(format = "yyyy-MM-dd HH:mm:ss",name = "createTime")
private Date date;
}


