Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Snakeyaml to convert yaml to pojo

I want to load a list of POJO from my yaml file. Is it possible for me to do that using snake yaml?

my yaml file looks something like this --

- pty1:val1
  pty2:val2

- pty1:val1
  pty2:val2

And my pojo -

class pojo {
  String pty1;
  String pty2;
}

Snakeyaml documentation does say to use loadAs() but that loads a single element. Can I load list of such elements with automatic type binding?

Thanks!

like image 224
amrk7 Avatar asked Nov 11 '22 22:11

amrk7


1 Answers

I've started using Jackson's YAML format plugin for serializing and deserializing YAML. Quite friendly.

like image 56
amrk7 Avatar answered Nov 14 '22 23:11

amrk7