Avoiding Null fields in yaml output.

27 views
Skip to first unread message

Prasanna Murthy

unread,
Sep 26, 2016, 2:40:55 AM9/26/16
to yamlbeans-users
Hi,
Is there a way to tell yamlbeans not to add fields that has null values?

Eg:

public class Person {
    private String name;
    private int age;
    private String address;
    public Person() {
    }
    //getters and setters
}

If the object is 

Person p = new Person();
p.setName("aaa");
p.setAge(50);

Then the resultant yaml is like this,

name: aaa
address: 
age: 50

The question is, 

Is there a way to avoid "address:" being added in output?

Regards,
Prasanna.
Reply all
Reply to author
Forward
0 new messages