Maps can be serialized with String
keys
val config =
ConfigFactory.parseString(
"""
|map {
| foo = 5
| bar = 6
|}"""
.trimMargin(),
)
val map: Map<String, Int> = config.extract("map")
println(map["foo"] == 5) // true
println(map["bar"] == 6) // true
or with arbitrary keys
val config =
ConfigFactory.parseString(
"""
|map = [{
| key = 5
| value = "foo"
|}
|{
| key = 6
| value = "bar"
|}]"""
.trimMargin(),
)
val map: Map<Int, String> = config.extract("map")
println(map[5] == "foo") // true
println(map[6] == "bar") // true