Add to State ```companion object { private val...
# getting-started
n
Add to State
Copy code
companion object {
    private val map = Type.values().associateBy(Type::value);
    fun fromInt(type: Int) = map[type]
}
Then call
Copy code
val s = json.getPremitive("state")
val stateEnum = State.fromInt(s)