From a6e4099a5cf19d94cd3c98013a1f2b3ff305a9cc Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 8 Jan 2014 14:46:00 -0500 Subject: [PATCH] Add a note on serialization/rendering to Config docs --- .../main/java/com/typesafe/config/Config.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config/src/main/java/com/typesafe/config/Config.java b/config/src/main/java/com/typesafe/config/Config.java index ce138bad..e30b5349 100644 --- a/config/src/main/java/com/typesafe/config/Config.java +++ b/config/src/main/java/com/typesafe/config/Config.java @@ -130,6 +130,28 @@ import java.util.concurrent.TimeUnit; * the top). * *

+ * Serialization + * + *

+ * Convert a Config to a JSON or HOCON string by calling + * {@link ConfigObject#render()} on the root object, + * myConfig.root().render(). There's also a variant + * {@link ConfigObject#render(ConfigRenderOptions)} which allows you to control + * the format of the rendered string. (See {@link ConfigRenderOptions}.) Note + * that Config does not remember the formatting of the original + * file, so if you load, modify, and re-save a config file, it will be + * substantially reformatted. + * + *

+ * As an alternative to {@link ConfigObject#render()}, the + * toString() method produces a debug-output-oriented + * representation (which is not valid JSON). + * + *

+ * Java serialization is supported as well for Config and all + * subtypes of ConfigValue. + * + *

* This is an interface but don't implement it yourself * *