I have this enum: ```import com.google.gson.annota...
# serialization
b
I have this enum:
Copy code
import com.google.gson.annotations.SerializedName
import kotlinx.serialization.SerialName

enum class Size(private val value: String) {

    @SerialName("S")
    SMALL("S"),

    @SerialName("M")
    MEDIUM("M"),

    @SerialName("L")
    LARGE("L"),

    @SerialName("XL")
    XLARGE("XL");

    override fun toString(): String = value
}
but then I get this error: kotlinx.serialization. SerializationException: com..... model. Size does not contain element with name 'XL' and the json looks like this: "size": "XL", So do I really need to read a custom serializer for each enum?
s
Mark your entire enum as serializable.
b
19ef342fc9a2d70e227ecbc45b926199.jpg
s
Also take a look at this btw https://issuetracker.google.com/issues/358687142 if you use enums with type-safe navigation