-
-
Notifications
You must be signed in to change notification settings - Fork 151
Description
Hello,
I have the following issue/question for which I was hoping to find a easy solution.
I have inherited a large codebase where I am trying to migrate from jackson 2.6.4 to 2.9.8. The project contains multiple YAML
files which are deserialized using com.fasterxml.jackson.dataformat.yaml.YAMLMapper
. Most of these files contain empty fields e.g.
emptyStringField:
With version 2.6.4 these fields were being decoded to empty strings, while after migrating to 2.9.8 the field evaluated to null
. I have managed to trace the diverging behavior in com.fasterxml.jackson.dataformat.yaml.YAMLParser#_decodeScalar
.
The 2.6 version was evaluating the field to JsonToken.VALUE_STRING
while the 2.9 version is using SnakeYaml implicit resolvers and evaluates to JsonToken.VALUE_NULL
.
What is the desirable way to keep the behavior from 2.6, deserialize empty fields to empty string instead of null, after migrating to 2.9?