Usage of Jackson @JsonProperty annotation for kotlin data classes

后端 未结 6 1230
野趣味
野趣味 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 08:14

    You can add the jackson-module-kotlin (https://github.com/FasterXML/jackson-module-kotlin) and register the kotlin module with jackson:

    val mapper = ObjectMapper().registerModule(KotlinModule())
    

    Then it (and many other things) works automagically.

提交回复
热议问题