<How do I make a missing JSON field deserialize to...
# stackoverflow
u
How do I make a missing JSON field deserialize to the default value given by my entity class, and not to null? I have an entity, defined using a data class: @Entity data class BlogPost( (...) val title: String, (...) val slug: String = title.toSlug(), ) As per this answer, I expected that a JSON object without a slug field would deserialize to a BlogPost whose slug was created using my .toSlug() extension method – but, to my surprise, the deserialized .slug ends up being null even though I thought it wasn't nullable (it's a...