You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using a Mixin to override a @JsonIgnore field in a POJO.
This is done by declaring the field in the Mixin wih a @JsonProperty annotation.
We noticed this behavior is no longer valid in 2.14.x
Given the following code
public class MixinSample {
public static class CustomerMixin {
@JsonProperty // Also tried @JsonIgnore(false)
public String id;
}
public static void main(String[] args) throws Exception {
Customer customer = new Customer();
customer.setId("123"); // This POJO has a JsonIgnore on the id field
customer.setName("Joe");
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.addMixIn(Customer.class, CustomerMixin.class);
System.out.println("objectMapper = " + objectMapper.writeValueAsString(customer));
}
}
With jackson-databind 2.13.x it outputs as expected (Mixin overrides the JsonIgnore id field):
{"id":"123","name":"Joe"}
With jackson-databind 2.14.x it doesn't seem to take into account the mixin :
{"name":"Joe"}
The text was updated successfully, but these errors were encountered:
ddewaele
changed the title
Mixin with @JsonProperry to override @JsonIgnore no longer works in 2.14
Mixin with @JsonProperry to override @JsonIgnore no longer works in 2.14.x
Mar 7, 2023
We are using a Mixin to override a
@JsonIgnore
field in a POJO.This is done by declaring the field in the Mixin wih a
@JsonProperty
annotation.We noticed this behavior is no longer valid in 2.14.x
Given the following code
With jackson-databind 2.13.x it outputs as expected (Mixin overrides the JsonIgnore id field):
With jackson-databind 2.14.x it doesn't seem to take into account the mixin :
The text was updated successfully, but these errors were encountered: