I've been trying to deserialize the following yaml to a List<Stage>
using SnakeYaml:
- name: Stage1
items:
- item1
- item2
- name: Stage2
items:
- item3
public class Stage {
private String name;
private List<String> items;
public Stage() {
}
public Stage(String name, List<String> items) {
this.name = name;
this.items = items;
}
// getters and setters
}
The closest question I found was SnakeYaml Deserialise Class containing a List of Objects.
After reading it, I am aware of Constructor
and TypeDescriptor
classes, but I am still unable to get it working (I get list of HashMaps, not Stages).
The difference with the question in the link above is that my top-level structure is a list, not a custom object.