Sorry about the duplicate, the existing answers are not applicable/did not work for me. Example: Jackson Not Overriding Getter with @JsonProperty
Below is my object, it is still coming back as zipValid
and applianceTypeValid
however I am looking for isZipValid
and isApplianceTypeValid
.
During debugging, I noticed that this line jsonResponse.put("statusResponse", new JSONObject(responseStatus));
is where it gets changed to zipValid
and applianceTypeValid
. responseStatus
has the correct values as expected, but the moment responseStatus
is loaded intojsonResponse
, gone. Don't know is this helps.
package com.dish.wfm.services.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class ValidationDTO {
private boolean isZipValid;
private boolean isApplianceTypeValid;
private List<String> partnerEnabledProductTypes;
@JsonProperty(value="isZipValid")
public boolean isZipValid() {
return isZipValid;
}
public void setZipValid(boolean zipValid) {
isZipValid = zipValid;
}
@JsonProperty(value="isApplianceTypeValid")
public boolean isApplianceTypeValid() {
return isApplianceTypeValid;
}
public void setApplianceTypeValid(boolean applianceTypeValid) {
isApplianceTypeValid = applianceTypeValid;
}
public List<String> getPartnerEnabledProductTypes() {
return partnerEnabledProductTypes;
}
public void setPartnerEnabledProductTypes(List<String> partnerEnabledProductTypes) {
this.partnerEnabledProductTypes = partnerEnabledProductTypes;
}
}
Thanks!