How do you actually parse values ​​in YAML in Java?

I have a YAML file that I use as my configuration file. This is true,

tests: - category: some_category test: - name: hello key1: value1 key2: value2 - name: hithere key1: value1 key2: value2 

I want to do something like this:

 for all tests as test: print test.name + test.key1 

I looked at JYaml and SnakeYaml, but all they think is a map from YAML objects in Java. YLL is not suitable for this? Is there an easy way to achieve this? all i need is to iterate over and get the values ​​of each, sort of like a DOM bypass.

+6
java parsing yaml
source share
1 answer

Ok, I figured it out. I use YamlBeans, which provides methods for this: https://github.com/EsotericSoftware/yamlbeans

+1
source share

All Articles