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?