Hey guys, I have a problem with jackson deserializ...
# getting-started
a
Hey guys, I have a problem with jackson deserialization I have a model that has a field of an Enum type
Copy code
data class Person (val gender: GenderEnum)
GenderEnum
Copy code
enum class GenderEnum(val type: Sring) {
MALE("MALE")
FEMALE("FEMALE")
OTHER("OTHER")
}
and my api response is
Copy code
"data": { gender: "male" }
Now, I am getting an error saying,
Cannot construct instance of the Person class, problem: Parameter specified as non-null is null: gender
anyone has the problem with jackson before ?
m
There's a data-field in your JSON. You probably need another wrapper class as well:
Copy code
data class Data(val data: Person)