I'm using Jackson to serialize and deserialize YAML but I'm encountering a problem with deserializing merge operator.
For example:
- &item001
boolean: true
integer: 7
float: 3.14
- &item002
boolean: false
- <<: [ *item002, *item001 ]
This yaml file isn't deserialized properly with jackson yaml.
This is the code I'm using:
val text = ..... //
val mapper = ObjectMapper(YAMLFactory()
.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER))
.registerKotlinModule()
val list = mapper.readValue<Any>(text)
And it outputs basically:
[{"boolean":true,"integer":7, "float": 3.14}, {"boolean": false}, {"<<": 2}]
Rather than:
[{"boolean":true,"integer":7, "float": 3.14}, {"boolean": false}, {"boolean":false,"integer":7, "float": 3.14}]
It's strange though because Jackson YAML uses SnakeYAML underlying and if I perform the same operation with SnakeYAML it deserializes correctly.
Of course I could switch to SnakeYAML but my project needs both json and yaml converters and Jackson provides me with both.
Any suggestions?