I want to generate Hocon config dynamically.
Input Map and
output file with below content
block{
key1 : value
key2 : value
}
Trying to read map
var myMap = new util.HashMap[String,AnyRef]()
val myConfig = ConfigFactory.parseMap(myMap)
myConfig.toString print below
Config(SimpleConfigObject({"key":"value"}))
not able to figure out how to extract conf from it
I tried below option but it prints in JSON format
val finalConfig : String =
myConfig.root().render( ConfigRenderOptions.defaults())
println(finalConfig)
Any other approach to generate conf so that nested structure can be supported ?
Edit: Found solution Nested config can be created using ConfigFactory.withValue https://marcinkubala.wordpress.com/2013/10/09/typesafe-config-hocon/