[android] No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator

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.

This question is related to android kotlin jackson retrofit2

The answer is

I got here searching for this error:

No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator

Nothing to do with Retrofit but if you are using Jackson this error got solved by adding a default constructor to the class throwing the error. More here: https://www.baeldung.com/jackson-exception

You need to use jackson-module-kotlin to deserialize to data classes. See here for details.

The error message above is what Jackson gives you if you try to deserialize some value into a data class when that module isn't enabled or, even if it is, when the ObjectMapper it uses doesn't have the KotlinModule registered. For example, take this code:

data class TestDataClass (val foo: String)

val jsonString = """{ "foo": "bar" }"""
val deserializedValue = ObjectMapper().readerFor(TestDataClass::class.java).readValue<TestDataClass>(jsonString)

This will fail with the following error:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `test.SerializationTests$TestDataClass` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)

If you change the code above and replace ObjectMapper with jacksonObjectMapper (which simply returns a normal ObjectMapper with the KotlinModule registered), it works. i.e.

val deserializedValue = jacksonObjectMapper().readerFor(TestDataClass::class.java).readValue<TestDataClass>(jsonString)

I'm not sure about the Android side of things, but it looks like you'll need to get the system to use the jacksonObjectMapper to do the deserialization.

If you're using Lombok on a POJO model, make sure you have these annotations:


It could vary, but make sure @Getter and especially @NoArgsConstructor.

I know this is an old post, but for anyone using Retrofit, this can be useful useful.

If you are using Retrofit + Jackson + Kotlin + Data classes, you need:

  1. add implement group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: '2.7.1-2' to your dependencies, so that Jackson can de-serialize into Data classes
  2. When building retrofit, pass the Kotlin Jackson Mapper, so that Retrofit uses the correct mapper, ex:
    val jsonMapper = com.fasterxml.jackson.module.kotlin.jacksonObjectMapper()

    val retrofit = Retrofit.Builder()

Note: If Retrofit is not being used, @Jayson Minard has a more general approach answer.

I solved this issue by adding a no argument constractor. If you are using Lombok, you only need to add @NoArgsConstructor annotation:

public class User {
    private Long userId;
    private String shortName;

As the error mentioned the class does not have a default constructor.

Adding @NoArgsConstructor to the entity class should fix it.

I had a similar issue (using Jackson, lombok, gradle) and a POJO without no args constructor - the solution was to add


to the lombok.config file

Extending Yoni Gibbs's answer, if you are in an android project using retrofit and configure serialization with Jackson you can do these things in order to deserialization works as expected with kotlin's data class.

In your build gradle import:

implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.11.+"

Then, your implementation of retrofit:

val serverURL = "http://localhost:8080/api/v1"

val objectMapper = ObjectMapper()
//Only if you are using Java 8's Time API too, require jackson-datatype-jsr310

           .readTimeout(1, TimeUnit.MINUTES)//No mandatory
            .connectTimeout(1, TimeUnit.MINUTES)//No mandatory
            .addInterceptor(UnauthorizedHandler())//No mandatory

Data class:

@JsonIgnoreProperties(ignoreUnknown = true)
data class Task(val id: Int,
                val name: String,
                @JsonSerialize(using = LocalDateTimeSerializer::class)
                @JsonDeserialize(using = LocalDateTimeDeserializer::class)
                val specificDate: LocalDateTime?,
                var completed: Boolean,
                val archived: Boolean,
                val taskListId: UUID?

I had this issue and i fixed with the code below.

open class JacksonMapper {

    open fun mapper(): ObjectMapper {
        val mapper = ObjectMapper()

        return mapper

I'm using rescu with Kotlin and resolved it by using @ConstructorProperties

    data class MyResponse @ConstructorProperties("message", "count") constructor(
        val message: String,
        val count: Int

Jackson uses @ConstructorProperties. This should fix Lombok @Data as well.

If you are using LOMBOK. Create a file lombok.config if you don't have one and add this line.


My cause of issue seems very uncommon to me, not sure if anybody else gets the error under same condition, I found the cause by diffing previous commits, here you go :

Via my build.gradle I was using these 2 compiler options, and commenting out this line fixed the issue

//compileJava.options.compilerArgs = ['-Xlint:unchecked','-Xlint:deprecation']

If you are using Unirest as the http library, using the GsonObjectMapper instead of the JacksonObjectMapper will also work.

<!-- https://mvnrepository.com/artifact/com.konghq/unirest-object-mappers-gson -->
Unirest.config().objectMapper = GsonObjectMapper()

When you are using Lombok builder you will get the above error.

 @JsonDeserialize(builder = StationResponse.StationResponseBuilder.class)
 public class StationResponse{
   //define required properties 

 @JsonIgnoreProperties(ignoreUnknown = true)
 @JsonPOJOBuilder(withPrefix = "")
 public static class StationResponseBuilder {}

Reference : https://projectlombok.org/features/Builder With Jackson

I could resolve this problem in Kotlin with help of @JacksonProperty annotation. Usage example for above case would be:

import com.fasterxml.jackson.annotation.JsonProperty
data class Station(
     @JacksonProperty("repsol_id") val repsol_id: String,
     @JacksonProperty("name") val name: String,

Encountered the same error in below Usecase.

I tried to hit the Rest(Put mapping) end point using sprint boot(2.0.0 Snapshot Version) without having default constructor in respective bean.

But with latest Spring Boot versions(2.4.1 Version) the same piece of code is working without error.

so the bean default constructor is no longer needed in latest version of Spring Boot

Just want to point out that this answer provides a better explanation.
Basically you can either have @Getter and @NoArgConstructor together
or let Lombok regenerates @ConstructorProperties using lombok.config file,
or compile your java project with -parameters flags,
or let Jackson use Lombok's @Builder

Questions with android tag:

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8? "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' GoogleMaps API KEY for testing Can I use library that used android support with Androidx projects. How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Android Material and appcompat Manifest merger failed Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 How to format DateTime in Flutter , How to get current time in flutter? How to change package name in flutter? Failed to resolve: com.android.support:appcompat-v7:28.0 What is AndroidX? Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve FirebaseInstanceIdService is deprecated installation app blocked by play protect Handling back button in Android Navigation Component Android design support library for API 28 (P) not working Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Install Android App Bundle on device Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. How to develop Android app completely using python? Invoke-customs are only supported starting with android 0 --min-api 26 Flutter.io Android License Status Unknown How to open Android Device Monitor in latest Android Studio 3.1 Default interface methods are only supported starting with Android N How can I change the app display name build with Flutter? Error:(9, 5) error: resource android:attr/dialogCornerRadius not found error: resource android:attr/fontVariationSettings not found Flutter does not find android sdk Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior flutter run: No connected devices Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation' PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)

Questions with kotlin tag:

No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Default interface methods are only supported starting with Android N Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 startForeground fail after upgrade to Android 8.1 How to get current local date and time in Kotlin How to add an item to an ArrayList in Kotlin? HTTP Request in Kotlin How can I get a random number in Kotlin? Kotlin Android start new Activity Smart cast to 'Type' is impossible, because 'variable' is a mutable property that could have been changed by this time Android - How to achieve setOnClickListener in Kotlin? What's the Kotlin equivalent of Java's String[]? Val and Var in Kotlin Kotlin - How to correctly concatenate a String Android Room - simple select query - Cannot access database on the main thread How to make primary key as autoincrement for Room Persistence lib Kotlin: How to get and set a text to TextView in Android using Kotlin? Constants in Kotlin -- what's a recommended way to create them? Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details How to call a function after delay in Kotlin? Kotlin Error : Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7 How to parse JSON in Kotlin? What is the equivalent of Java static methods in Kotlin? Kotlin's List missing "add", "remove", Map missing "put", etc? How to create empty constructor for data class in Kotlin Android How to check if a "lateinit" variable has been initialized? Sort collection by multiple fields in Kotlin Kotlin - Property initialization using "by lazy" vs. "lateinit" How to convert a Kotlin source file to a Java source file How do I initialize Kotlin's MutableList to empty MutableList? Error: Execution failed for task ':app:clean'. Unable to delete file Kotlin unresolved reference in IntelliJ How to initialize an array in Kotlin with values? Unfortunately MyApp has stopped. How can I solve this? Format in kotlin string templates Android Animation Alpha Opening Android Settings programmatically Kotlin Ternary Conditional Operator How to make an Android device vibrate? with different frequency? Android Get Current timestamp? how to access downloads folder in android? Place cursor at the end of text in EditText Alarm Manager Example How to launch an Activity from another Application in Android

Questions with jackson tag:

No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator JSON parse error: Can not construct instance of java.time.LocalDate: no String-argument constructor/factory method to deserialize from String value How to convert JSON string into List of Java object? Deserialize Java 8 LocalDateTime with JacksonMapper java.lang.IllegalArgumentException: No converter found for return value of type java.lang.ClassNotFoundException: com.fasterxml.jackson.annotation.JsonInclude$Value How to modify JsonNode in Java? Deserialize JSON with Jackson into Polymorphic Types - A Complete Example is giving me a compile error Convert Map to JSON using Jackson Required request body content is missing: org.springframework.web.method.HandlerMethod$HandlerMethodParameter java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.testing.models.Account Java 8 LocalDate Jackson format JsonParseException: Unrecognized token 'http': was expecting ('true', 'false' or 'null') How to customise the Jackson JSON mapper implicitly used by Spring Boot? serialize/deserialize java 8 java.time with Jackson JSON mapper Can not deserialize instance of java.lang.String out of START_ARRAY token No content to map due to end-of-input jackson parser Cannot deserialize instance of object out of START_ARRAY token in Spring Webservice receiving json and deserializing as List of object at spring mvc controller Using Spring RestTemplate in generic method with generic parameter Why when a constructor is annotated with @JsonCreator, its arguments must be annotated with @JsonProperty? Representing null in JSON Can not deserialize instance of java.util.ArrayList out of START_OBJECT token Parsing JSON in Java without knowing JSON format Convert JsonNode into POJO Spring Rest POST Json RequestBody Content type not supported Issue with parsing the content from json file with Jackson & message- JsonMappingException -Cannot deserialize as out of START_ARRAY token how to convert JSONArray to List of Object using camel-jackson Setting default values to null fields when mapping with Jackson Correct set of dependencies for using Jackson mapper Pretty printing JSON from Jackson 2.2's ObjectMapper Jackson how to transform JsonNode to ArrayNode without casting? Convert a Map<String, String> to a POJO Jackson serialization: ignore empty values (or null) Converting Java objects to JSON with Jackson Casting LinkedHashMap to Complex Object How do I disable fail_on_empty_beans in Jackson? jackson deserialization json to java-objects Can not deserialize instance of java.util.ArrayList out of VALUE_STRING Convert JSON String to Pretty Print JSON output using Jackson Jackson - best way writes a java list to a json array Cannot construct instance of - Jackson Spring REST Service: how to configure to remove null objects in json response When is the @JsonProperty property used and what is it used for? Only using @JsonIgnore during serialization, but not deserialization Jackson enum Serializing and DeSerializer Date format Mapping to JSON Jackson Jackson JSON custom serialization for certain fields Convert Java Object to JsonNode in Jackson How to tell Jackson to ignore a field during serialization if its value is null?

Questions with retrofit2 tag:

No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator Retrofit 2: Get JSON from Response body How to Upload Image file in Retrofit 2 Retrofit 2 - URL Query Parameter POST Multipart Form Data using Retrofit 2.0 including image Retrofit 2.0 how to get deserialised error response.body Logging with Retrofit 2 How to log request and response body with Retrofit-Android?