我有一个POJO映射,我使用filp->f_dentry->d_inode
Jackson
它序列化为
{栏:"值"}
是否有杰克逊注释来获取 JSON 中的另一个字段相同的值但具有不同的别名,例如
{bar:" value",another_bar:" value"}
答案 0 :(得分:1)
这应该可以用来复制价值,不过为什么你想要浪费空间就像这样令人费解:
public class Foo {
private String bar;
@JsonProperty
public String getBar() {
return this.bar;
}
public void setBar(String bar) {
this.bar = bar;
}
@JsonProperty("another_bar")
public String getAnotherBar() {
return this.bar;
}
}