enum

var enum: Any?(source)

List of allowed values (enumeration) of any JSON type.

Accepts List containing JsonElement, String, Number, Boolean, null, List (converted to JsonArray), or Map (converted to JsonObject). Values are automatically converted to JsonElement recursively.

Example

generic {
// Mix of plain Kotlin types, collections, and JsonElement
enum = listOf(
42,
"text",
true,
null,
listOf(1, 2, 3),
mapOf("key" to "value"),
JsonArray(listOf(JsonPrimitive(1), JsonPrimitive(2))),
JsonObject(mapOf("key" to JsonPrimitive("value")))
)
}