There is a very simple class:
class Price(
@JsonProperty("YPRICE")
val yprice: String? = null,
@JsonProperty("ZPRICE")
val zPrice: String? = null
)
And the following code to serialize to string:
val mapper = ObjectMapper().registerKotlinModule()
mapper.writeValue(System.out, Price())
The result in console is:
{"YPRICE":null,"zprice":null}
If changing the property of zPrice
to zprice
, then the result changes to:
{"YPRICE":null,"ZPRICE":null}
And if changing the property of yprice
to yPrice
, then the result changes to:
{"yprice":null,"zprice":null}
It seems that @JsonProperty
does not work for the camel case properties.