Jackson JSON field mapping capitalization?
Since your setter method is named setMDReqID(…)
Jackson assumes the variable is named mDReqID
because of the Java naming conventions (variables should start with lower case letters).
If you really want a capital letter use the @JsonProperty annotation on the setter (or - for serialization - on the getter) like this:
@JsonProperty("MDReqID")
public void setMDReqID(String MDReqID) {
this.MDReqID = MDReqID;
}
You can also do
@JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class)
on the class to capitalise all property names in the JSON message
Add @JsonProperty
on the setter that matches the property name in your received JSON string:
@JsonProperty("MDReqID")
public void setMDReqID(String MDReqID) {
this.MDReqID = MDReqID;
}
Additionally add @JsonProperty
annotation to the getter as well for your output to appear in the conventional format:
@JsonProperty("mDReqID")
public String getMDReqID() {
return MDReqID;
}
Now you can name your variable whatever you like:
private String mdReqID;