@@ -0,0 +1,1397 @@
+package com.github.okapies.hoc2js;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.File;%0Aimport java.io.InputStreamReader;%0Aimport java.io.Reader;%0A%0Aimport com.typesafe.config.Config;%0Aimport com.typesafe.config.ConfigFactory;%0Aimport com.typesafe.config.ConfigParseOptions;%0Aimport com.typesafe.config.ConfigSyntax;%0Aimport com.typesafe.config.ConfigRenderOptions;%0Aimport com.typesafe.config.ConfigResolveOptions;%0A%0A/**%0A * Very simple utility for converting from Typesafe's HOCON to JSON.%0A * See https://github.com/typesafehub/config/blob/master/HOCON.md%0A */%0Apublic class Hoc2Js %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Config config = ConfigFactory.empty();%0A%0A%09%09// parse%0A%09%09ConfigParseOptions parseOpts = ConfigParseOptions.defaults()%0A%09%09%09.setSyntax(ConfigSyntax.CONF); // HOCON%0A%09%09if (args.length %3E 0) %7B%0A%09%09%09for (String filename : args) %7B%0A%09%09%09%09config = config.withFallback(ConfigFactory.parseFile(new File(filename)));%0A%09%09%09%7D%0A%09%09%7D else %7B%0A%09%09%09// read from stdin instead of .conf files%0A%09%09%09config = ConfigFactory.parseReader(%0A%09%09%09%09new BufferedReader(new InputStreamReader(System.in)));%0A%09%09%7D%0A%0A%09%09// resolve%0A%09%09ConfigResolveOptions resolveOpts = ConfigResolveOptions.defaults();%0A%09%09config = config.resolve(resolveOpts);%0A%0A%09%09// render%0A%09%09ConfigRenderOptions renderOpts = ConfigRenderOptions.defaults()%0A%09%09%09.setOriginComments(false)%0A%09%09%09.setOriginComments(false);%0A%09%09System.out.print(config.root().render(renderOpts));%0A%09%7D%0A%7D%0A

add a source file