Java Jackson Databind Objectmapper 2.10-不工作
我正在尝试将jackson库从2.9.x更新到2.11.x。注意到2.10中有一些更改,因此,下面的内容不起作用Java Jackson Databind Objectmapper 2.10-不工作,java,spring-boot,jackson,jackson-databind,Java,Spring Boot,Jackson,Jackson Databind,我正在尝试将jackson库从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 Custom
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();
class客户{
@JsonProperty(“值”)
字符串值;
@杰索尼奥雷
字符串状态;
//接球手和接球手
}
类CustomerResponse{
@JsonProperty
字符串id;
@JsonProperty
顾客;
}
班级反应{
@JsonProperty
客户响应;
}
Response val=getReturn();
ObjectMapper obm=新的ObjectMapper();
CustomerResponse scc=obm.convertValue(val.getCustomerResponse(),new TypeReference(){});
字符串statusFromCustomer=scc.getCustomer().getStatus();
使用Jackson 2.9.x时,statusFromCustomer的值按预期工作,但在2.10中返回null
这是因为@JsonIgnore吗?如果是,那么它在2.9.x版本中是如何工作的?请添加更多详细信息:
SomeCustomClass
类和相关类。还提供JSON
payload。尝试将属性名称作为注释元数据添加到受影响字段的JsonProperty注释中,例如:@JsonProperty(“statusFromCustomer”)。发布JSON。。