I am trying to consume an API using Retrofit and Jackson to deserialize. I am getting the onFailure error
No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator.
Reason: This error occurs because jackson library doesn’t know how to create your model which doesn’t have an empty constructor and the model contains constructor with parameters which didn’t annotated its parameters with
@JsonProperty("field_name"). By default java compiler creates empty constructor if you didn’t add constructor to your class.
Solution: Add an empty constructor to your model or annotate constructor parameters with
If you use a Kotlin data class then also can annotate with
@JsonProperty("field_name") or register jackson module kotlin to
You can create your models using http://www.jsonschema2pojo.org/.
Answered By – Bek