Having a simple yml file test.yml
as follows
color: 'red'
I load and dump the file as follows
final DumperOptions yamlOptions = new DumperOptions();
yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Yaml yaml = new Yaml(yamlOptions);
Object result = yaml.load(new FileInputStream(new File("test.yml")));
System.out.println(yaml.dump(result));
I expect to get
color: 'red'
However, the during the dump, the serializer leaves out the quotes and prints
color: red
How can I make the serializer to print the original quotes too?