yaml description: Jvyaml example author: name: John Doe age: 30 Yaml yaml = new Yaml(); String description = (String) data.get("description"); Map<String, Object> author = (Map<String, Object>) data.get("author"); String name = (String) author.get("name"); int age = (int) author.get("age"); public class Example { private String description; private String authorName; private int authorAge; } Example example = yaml.loadAs(new FileInputStream("example.yaml"), Example.class); System.out.println(example.getDescription()); System.out.println(example.getAuthorName()); System.out.println(example.getAuthorAge());


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