jackson json转bean忽略没有的字段 not marked as ignorable
@JsonIgnore注解用来忽略某些字段,可以用在Field或者Getter方法上,用在Setter方法时,和Filed效果一样。这个注解只能用在POJO存在的字段要忽略的情况,不能满足现在需要的情况。@JsonIgnoreProperties(ignoreUnknown =true),将这个注解写在类上之后,就会忽略类中不存在的字段,可以满足当前的需要。这个注解还可以指定要忽略的字段。使用方法如下:@JsonIgnoreProperties({ “internalId”, “secretKey..
转载
2020-10-10 16:34:27 ·
1466 阅读 ·
0 评论