@JsonIgnore
@JsonProperty
@JsonIgnoreProperties
使用 @JsonIgnore 注解,在需要忽略的 user 字段。
例子:
private String line;
private String flight;
private String class;
@JsonIgnore
private String testPar;
@JsonIgnore
private String week;
// testPar 和 week 在用jackson时就不会序列化到json中
更多信息请参考:
http://wiki.fasterxml.com/JacksonAnnotations
http://www.cowtowncoder.com/blog/archives/2011/02/entry_443.html
本文介绍如何使用@JsonIgnore注解在Jackson中忽略特定字段的序列化过程,避免不必要的数据传输。
2404

被折叠的 条评论
为什么被折叠?



