I'm using snakeYaml (snakeyaml-engine-2.1) to serialise a pojo. Atm the serilisation produces the following output
name: "OuterYamlElementName"
label: "OuterYamlElementLabel"
fields:
label: "outerYamlFieldLabel"
value: "outerYamlFieldValue"
isRequired: true
toggle: "+Test-Outer-Yaml-Field"
however I want the yaml to be generated like so
name: "OuterYamlElementName"
label: "OuterYamlElementLabel"
fields:
- {label: "outerYamlFieldLabel", value: "outerYamlFieldValue", isRequired: true, toggle: "+Test-Outer-Yaml-Field"}
I know their is ways to customise the output produced via class DumpSettings
within snake yaml through setters
setCanonical
setDefaultFlowStyle
etc
however I haven't been able to produce that output as of yet unfortunately. I'd like the output to come condensed as the Yaml produced is relatively big (the example above only includes a snippet hence the ask). In addition the second Yaml sample is deserialised by snake yaml so it should be able to produce the same output I would think. Would somebody know what settings are needed to create the structure as in the second example? Thanks in advance.