title: Converting a list of POJO's to a YAML file in JAVA
body: <p>I  have found many examples in StackOverflow but I guess none of them are facing this problem which I have:</p>
  <p>I am trying to convert a List of POJOs to a YAML format and writing the file onto the disk.
  I am using Snake Yaml with this dependancy in my Pom:</p>
  <pre><code> &lt;dependency&gt;
     &lt;groupId&gt;org.yaml&lt;/groupId&gt;
     &lt;artifactId&gt;snakeyaml&lt;/artifactId&gt;
     &lt;version&gt;1.18&lt;/version&gt;
    &lt;/dependency&gt;
  </code></pre>
  <p>My code :</p>
  <pre><code>Pojo po = new Pojo();
  po.setProperty1(&quot;po1&quot;);
  po.setProperty2(&quot;po2&quot;);
  po.setProperty3(&quot;po3&quot;);
  
  DumperOptions options = new DumperOptions();
  options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
  options.setPrettyFlow(true);
  
  Yaml yaml = new Yaml(options);
  String s = yaml.dump(po);
  
  Output :
  - !! com.test.Pojo
    Property1:&quot;po1&quot;
    Property2:&quot;po2&quot;
    Property3:&quot;po3&quot;
  
  Desired output:
  - Property1:&quot;po1&quot;
    Property2:&quot;po2&quot;
    Property3:&quot;po3&quot;
  </code></pre>
  <p>When I use <code>yaml.dump(myObject)</code> it also prints the object name along with its properties. Is there a way I can get the desired output?</p>