jsonapi-converter
jsonapi-converter copied to clipboard
@JsonProperty unexpectedly required
I have a JSON object with a boolean isFavorite
field, like so (simplified, obviously):
{ "attributes": { "isFavorite": false }}
If my kotlin class for parsing this object has an un-annotated isFavorite
field, like so:
var isFavorite: Boolean? = null
The resulting object's isFavorite
field remains null. However, if I redundantly annotate it with @JsonProperty
like so:
@JsonProperty("isFavorite") var isFavorite: Boolean? = null
it works as expected.
I have exactly the same issue. I have an object with a var isFavorite: Boolean
that is not parsed at all. @Human trick worked but why is this happening?
This is related to how Jackson works and not to the lib.