I'm using struts2(struts2-json-plugin) to handle Content-Type=application/json
request,
everything is fine where params style is lower camel case,like {"region":"China","version":"v4"}
.
But it can't work when params is upper camel case,like {"Region":"China","Version":"v4"}
.
I've already read struts docs(https://struts.apache.org/plugins/json/),and still not find the way to solve.
this is part of my struts.xml:
It can't work with case insensitive json objects because names are translated into Java class variables of the action class that are case sensitive.
The json plugin contains the interceptor named
json
which you should configure to the action to deserialize json content from the request. This answer points to some classes responsible for serialization/deserialization and populating Java objects.If you want to transform json objects with lower case names to camel case then you should override one of these classes before the population process to correspond to Java class variables names.