Usage of Jackson @JsonProperty annotation for kotlin data classes

后端 未结 6 1238
野趣味
野趣味 2020-12-09 07:14

kotlin 1.2.10 jackson-module-kotlin:2.9.0

I have the following data class in kotlin:

data class CurrencyInfo(
        @JsonProperty(\"currency_info\"         


        
6条回答
  •  感动是毒
    2020-12-09 07:59

    I faced this problem today and what I did was register KotlinModule() in my ObjectMapper(). Bellows follow an example.

    @Bean fun objectMapper = ObjectMapper().registreModule(KotlinModule())
    

    Above it's a dummy objectMapper, I believe that you should put other configurations in your objectMapper like serializers and so on

提交回复
热议问题