nil2l
companion object { private val map = Type.values().associateBy(Type::value); fun fromInt(type: Int) = map[type] }
val s = json.getPremitive("state") val stateEnum = State.fromInt(s)