问题描述
我正在尝试将杰克逊库从2.9.x更新到2.11.x。注意到2.10中有一些更改,因此,以下内容无法正常工作。
class Customer {
@JsonProperty("value")
String Value;
@JsonIgnore
String status;
// getters and setters
}
class CustomerResponse {
@JsonProperty
String id;
@JsonProperty
Customer customer;
}
Class Response {
@JsonProperty
CustomerResponse response;
}
Response val = getReturn();
ObjectMapper obm = new ObjectMapper();
CustomerResponse scc= obm.convertValue(val.getCustomerResponse(),new TypeReference<CustomerResponse>(){});
String statusFromCustomer = scc.getCustomer().getStatus();
使用Jackson 2.9.x时statusFromCustomer的值按预期工作,但在2.10中返回null。
这可能是因为@JsonIgnore吗?如果是,那么它在2.9.x版本中是如何工作的?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)