Given an Enum:
public enum CarStatus {
NEW("Right off the lot"),
USED("Has had several owners"),
ANTIQUE("Over 25 years old");
public String description;
public CarStatus(String description) {
this.description = description;
}
}
How can we set it up so Jackson can serialize and deserialize an instance of this Enum into and from the following format.
{
"name": "NEW",
"description": "Right off the lot"
}
The default is to simply serialize enums into Strings. For example "NEW"
.