0
votes

I have a SpringBoot (2.5.x) RestController which is returning Lists and would like to force the JSON representation to use specific naming convention for the properties. I've tried the spring.jackson.property-naming-strategy property in application.properties but it seems to have no effect. Also tried custom MappingJackson2HttpMessageConverter, using setPropertyNamingStrategy on the Autowired objectMapper, and using the @JsonNaming annotation in the controller class.

Any ideas on what I'm doing wrong?

Thanks!

--john

1
can you show what json you want to get ? and your classes, I think putting a reproducer in github is best :) - özkan pakdil

1 Answers

0
votes

Put this on the class

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)

But it is outdated

At the same time it is still available

I don't know why

my spring boot 2.5.4