我认为杰克逊没有基于方法的序列化,有没有什么办法可以使它基于字段?基于杰克逊字段序列化
例:
class Bean {
Integer i;
String s;
public Integer getI() { return this.i; }
public void setI(Integer i) { this.i = i; }
public bool isSetI() { return this.i != null; }
// same for s as well
}
输出JSON有 “i” 和 “塞提”。无论如何,我可以重写这只得到“我”? 此外,如果有一种方法可以做到这一点,而无需向课程添加任何注释(它们是自动生成的)。
此代码不能编译。你可以发布你正在使用的实际代码,以及你如何试图序列化? – 2012-04-20 14:52:55