Serializing Typesafe Config objects

questionersam picture questionersam · Apr 4, 2013 · Viewed 11.4k times · Source

I'd like to persist a Config object (https://github.com/typesafehub/config) as a serialized string(maybe JSON ??) and read it back when required. However, I didnt find any API on the Config api docs that supports. Any help on this is appreciated.

I tried

config.toString

but the result looks like

Config(SimpleConfigObject({...data}))

Answer

Sasha O picture Sasha O · May 25, 2013

Try this:

config.root().render(ConfigRenderOptions.concise())