import org.hjson.JsonValue; public class HjsonExample { public static void main(String[] args) { String hjsonString = "// This is a configuration file in Hjson format " + "{ " + " // Server settings " + " 'address': 'localhost', " + " 'port': 8080, " + " " + " // Database settings " + " 'database': 'my_db', " + " 'username': 'admin', " + " 'password': '123456' " + "}"; JsonValue jsonValue = JsonValue.readHjson(hjsonString); System.out.println(jsonValue.toString()); } } import org.hjson.JsonValue; public class LargeHjsonExample { public static void main(String[] args) { // Assume we have a large Hjson file named 'large_config.hjson' String hjsonPath = "/path/to/large_config.hjson"; JsonValue jsonValue = JsonValue.readHjsonFromFile(hjsonPath); System.out.println(jsonValue.toString()); } }


上一篇:
下一篇:
切换中文