Java 1.8, Jackson 2.1.5 Library
I need to override the behavior of how an object is serialized in json.
I need to ignore the property bonusfrom the json serialized response in case the value is null and the employee is employee Partner. However, trying to use the code below does not work properly.
class Employee{
private String bonus;
public String getBonus(){return bonus;}
public String setBonus(){this.bonus = bonus;}
}
class Partner extends Employee{
@Override
@JsonInclude(NON_NULL)
public String getBonus(){return super.getBonus();}
}
Any help?
source
share