Android Parsing JSON property to enum with Gson


Example

If you want to parse a String to enum with Gson:

{"status" : "open"}

public enum Status {
    @SerializedName("open")
    OPEN,
    @SerializedName("waiting")
    WAITING,
    @SerializedName("confirm")
    CONFIRM,
    @SerializedName("ready")
    READY
}