Serialising to Enum in Kotlin?
I am writing an android app as an ios developer, and struggling to get my Enum values to encode with kotlin.
I currently have
data class Context(
val context_type: ContextType
)
enum class ContextType {
WALKING, STATIONARY
}
the Json looks like this
"context": [{
"context_type": "walking"
}]
However it doesnt seem to serialise the values to an enum and is just null.
It crashes on attempt to access with:
java.lang.NullPointerException: Attempt to invoke virtual method...