Skip to content
Advertisement

Tag: snakeyaml

How to flatten dynamic yaml file using java

I want to parse dynamic yaml files using java into HashMap and access them using dot syntax (i.e “a.b.d”) Given the following example.yml: And can fetch it as Any idea How we can achieve this? Answer As Thorbjørn said in a comment, a HashMap is probably not the correct data structure for representing a YAML file. You should try looking

Parse list of beans with snakeyaml

Is it possible to parse with snakeyaml the following content and obtain a List<Radio> (where Radio is the appropriate java bean) ? new Yaml().load(…); returns a List<HashMap>, but I’d like to get a List<Radio> instead. Answer The only way I know is to use a top object to handle the collection. Yaml file : I just added “—” , new

Advertisement