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

Missing double quotes for the required field using Snake Yaml

i am trying to read a Yaml template and replace certain fields in the template dynamically and create a new Yaml file. My resultant yaml file should reflect the template in all aspects including the double quotes. But I am missing double quotes for the required fields when I use snake yaml. Can anyone please suggest to resolve this issue?

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