I am working with jackson-core-2.8.3 and I have a json which has element provided in multiple cases. I want to map it to my class but I am not able to do so because I can have only one type of PropertyNamingStratergy in my class.
Example Json:-
{"tableKey": "1","not_allowed_pwd": 10}
There can be another json like
{"tableKey": "1","notAllowedPwd": 10}
ClassToMap :-
class MyClass {
public String tableKey;
public Integer notAllowedPwd;
}
ObjectMapper code :-
ObjectMapperobjectMapper=new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES,true);
objectMapper.setSerializationInclusion(Include.NON_NULL);
objectMapper.setVisibility(PropertyAccessor.ALL,Visibility.NONE);
objectMapper.setVisibility(PropertyAccessor.FIELD,Visibility.ANY);
MyClass obj = objectMapper.readValue(s, MyClass.class);
I am not finding any solution anywhere. It will be good if anyone can help how to proceed.