YAML file editing

I was wondering if there was a way to edit a YAML file and save the edited version…
So it would be something like this maybe:

File yaml = new File(System.getProperty("user.home") + "/Desktop/*.*");
selectInput("Choose File", "fileSelected",yaml);
yaml.set("data.materials.example", "random string");

and so the yaml file saved would be something like:

    example: 'random string'

so I wanted to be able to get a yaml file, convert it to something like a YAMLConfiguration, edit it and save it, edited.

1 Like

I don’t thing java and processing are particularly friendly with yaml, ruby and JRubyArt are however. In my examples in JRubyArt I use the yaml gem which is easy to use and does exactly what you expect.


1 Like

I also found this library that I downloaded https://www.baeldung.com/java-snake-yaml
I use the Bukkit API for other projects, (this one is linking with them). Bukkit uses that so maybe it would be something to use.
I was able to use the Bukkit library in itself and snake yaml.
if anyone in the future needs to use yaml file editing, Bukkit has good support for it.

If someone came to this thread for the answer, I just downloaded spigot/bukkit and used it’s jar file as a library.