@JsonIgnore
用于字段上,表示该字段在序列化和反序列化的时候都将被忽略。
@JsonIgnoreProperties
主要用于类上:
@JsonIgnoreProperties(value = {"mobile","name"},ignoreUnknown = true)
表示对于mobile和name字段,反序列化和序列化均忽略,而对于Json中存在的未知字段,在反序列化时忽略,ignoreUnknown不对序列化起效。
@JsonIgnore
用于字段上,表示该字段在序列化和反序列化的时候都将被忽略。
@JsonIgnoreProperties
主要用于类上:
@JsonIgnoreProperties(value = {"mobile","name"},ignoreUnknown = true)
表示对于mobile和name字段,反序列化和序列化均忽略,而对于Json中存在的未知字段,在反序列化时忽略,ignoreUnknown不对序列化起效。