Good libraries to read, parse and modify yaml files in scala?

Are there any libraries which allow parsing and modifying yaml files? I tried circe-yaml. It converts yaml to json and then you parse and modify the json. Then convert the json back to yaml. Lot of information is lost in this process. Things get reordered and it’s difficult to get a sense of the changes via diff.

1 Like

I have used moulting YAML which has many nice features. However, I too had a reordering issue since internally maps are used (enough that I used a hand-rolled parser once when this was too much of a nuisance).

regards,
Siddhartha

2 Likes

I believe that our weePickle library handles YAML as well as a bunch of other formats, but I haven’t played with that aspect myself. Knowing the way weePickle works, it is likely that it preserves order (in general, it tries to avoid building intermediate maps when not necessary), but I can’t say for sure. It’s super-flexible by design, and one can build specialized visitors with the desired semantics, although that’s not trivial…

3 Likes

I’m interested in this question, too, and I’ve come across the following options. However, I have not tried any of them yet, so “buyer beware”:

3 Likes

sounds like this is what I was looking for. I will try this out