I'm trying to load up a Map[String, Any]
from the config file. It's currently written like this
map-name {
stringValue = "firstValue"
intValue = 1
booleanValue = true
}
Pureconfig is having trouble reading this config as a Map[String, Any]
. It only works if replace Any
with some strict type but I want more flexibility than this.
Is there any way around this?
Is there any way around this?
Yes there is. You can use this type: Map[String, ConfigValue]
ConfigValue
from its Scala Doc:
An immutable value, following the JSON type schema.
But then you can use ConfigObject
instead of Map[String, ConfigValue]
, as this is the same thing.
You can handle this now like a JSON-Object
structure.
Here are some examples: java-api-usage-examples.