How can I deserialize the Yaml comments into JAVA Type

5 views
Skip to first unread message

Rahul Kumar

unread,
Jul 3, 2020, 7:24:59 PM7/3/20
to jackson-user
Hi Team,
I have a YAML file as below:
---
#my variable
var1 : ok

My Yaml code is like below:

 ObjectMapper mapper = new ObjectMapper(new YAMLFactory());

 Object user = mapper.readValue(yamlfile,new TypeReference<Map<String, String>>() {});


While serializing this Yaml file into a MAP, I dont want to ignore comments written on top of variables in Yaml file , how can i do that in jackson ?

In short , i wanted to read Yaml comments as well using jackson and dont want to ignore them !


Regards

Rahul kumar


Reply all
Reply to author
Forward
0 new messages