In prior versions of jackson, we were using the following two ways to modify the Property Naming during serialization and deserialization of objects.
First way: Mentioning the following annotation on class level.
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
Second way: Setting the PropertyNamingStrategy in Object Mapper itself.
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SnakeCaseStrategy.class);
or,
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
Now as it has been deprecated from version 2.13.
https://github.com/FasterXML/jackson-databind/issues/2715
Now what are the alternative for the above thing.
Could anyone please help me with how it can be done?
Was trying the above two ways, but its is showing deprecated now.
CodePudding user response:
NOTE! Since 2.12 sub-classes defined here (as well as static singleton instances thereof) are deprecated due to databind#2715. Please use constants and classes in PropertyNamingStrategies instead.