is it possible to deserialize enums, which have a one based index?
enum Status {
Active,
Inactive
}
{status:1} means Status.Active, but Jackson makes it Status.Inactive 🙁
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can create a custom type deserialiser for your enum:
You can then tell Jackson to use your custom deserialiser for a property:
You can also configure the Jackson object mapper to use your custom deserialiser for all occurrences of the target type. See http://wiki.fasterxml.com/JacksonHowToCustomDeserializers.