I'm using Spring 4 MVC with Jackson 2 for my service. For one of the operations I have a request object that has an attribute where the leading camel case word this is only one letter in length:
private String aLogId;
This class has the appropriately named getters and setters:
public String getALogId() { return aLogId; }
public void setALogId(String aLogId) { this.aLogId = aLogId; }
However, when I attempt to post a request to this service using the corresponding JSON property:
{"aLogId":"This is a log id"}
I'm receiving a 500 response from the Spring framework saying the field is not recognized and my controller class is never called:
Could not read JSON: Unrecognized field "aLogId" (class
However, when I change the "L" to lower case, the request is deserialized as expected and my controller class is hit:
{"alogId":"This is a log id"}
Why does Jackson expect the "L" to be lower case when it is obviously the second word in the camel case convention for the attribute and intended to be in upper case? Is it because the first word is only a single letter long?
There are other attributes in the request object where the first word is more than one letter and those attributed don't face this same issue with the mismatch in case.
logAId
- would it fail too? – HawserlaidsetaLogId
andgetaLogId
. That flies in the face of convention though. There is definitely something 'buggy' when you have single letter words. – Atthia