How to convert null values to empty string when loading yaml file

Issue #408 invalid
Koen Smets
created an issue

We have a single JavaBean with like the following example class:

Class Config {
   private String a;
   private String b;
   private Integer c;
   ...
}
a:

b: 'Hello,world'
c: 0

When loading this example yaml file, property a is null, where I'd like it to be the empty String (likewise for all other null values belong to string properties).

Any ideas on how to accomplish this?

Comments (1)

  1. Andrey Somov repo owner

    This is not the best place to ask general questions.

    YAML spec has lots of ways to treat null and empty strings. If you want to deviate from the spec you have to write your custom Constructor. Examples are in the tests.

  2. Log in to comment