原文链接:Ignore Null Fields with Jackson
1. Overview 概述
This quick tutorial is going to cover how to set up Jackson to ignore null fields when serializing a java class.
这篇将会介绍在Jackson中序列化Java类时,如何忽略空值属性。
If we want to dig deeper and learn other cool things to do with the Jackson 2, we can head on over to the main Jackson tutorial.
如果想进一步深入了解Jackson2,可以点击 the main Jackson tutorial
2. Ignore Null Fields on the Class 在Java类中忽略空值属性
Jackson allow us to control this behavior at either the class level:
Jackson可以在类的层面上定义空值操作,示例如下
@JsonInclude(Include.NON_NULL)
public clas