英文:
How to parse YAML with SnakeYaml low-level API like getAsInt?
问题
SnakeYaml文档提供了如何将YAML反序列化为Java类的示例。
我正在寻找类似于GSON的getAsInt的简单低级API,SnakeYaml支持吗?
英文:
The SnakeYaml docs provide examples how to de-serialize YAML into Java Class.
I'm looking for simple low-level API that's similar to GSON getAsInt, does SnakeYaml support that?
答案1
得分: 1
如果您在没有指定表示类型的情况下使用SnakeYaml的load方法来加载一个Yaml对象,您将得到一个由List和Map集合组成的数据结构,其中"values"表示为String、Integer等的实例。
听起来这很接近您所寻找的内容。
英文:
If you use SnakeYaml's load method on a Yaml object created without specifying a representation type, you will get a data structure composed of List and Map collections, with the "values" represented as instances of String, Integer and so on.
It sounds like that is close to what you are looking for.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论