# YAML file editing

**URL:** <https://discourse.processing.org/t/yaml-file-editing/13602>\
**Category:** Coding Questions\
**Created:** [August 26, 2019, 3:24am UTC](https://discourse.processing.org/t/yaml-file-editing/13602 "2019-08-26T03:24:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RockyHawk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rockyhawk/32/14384_2.png) [@RockyHawk](https://discourse.processing.org/u/RockyHawk)\
**Post date:** [August 26, 2019, 3:24am UTC](https://discourse.processing.org/t/yaml-file-editing/13602/1 "2019-08-26T03:24:06Z")

</div>

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:

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

```

and so the yaml file saved would be something like:

```auto
data:
  materials:
    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.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [August 26, 2019, 8:37am UTC](https://discourse.processing.org/t/yaml-file-editing/13602/2 "2019-08-26T08:37:19Z")

</div>

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.  
[sketch](https://github.com/ruby-processing/JRubyArt-examples/blob/master/processing_app/topics/advanced_data/load_save_yaml.rb)

[library](https://github.com/ruby-processing/JRubyArt-examples/tree/master/processing_app/topics/advanced_data/library/bubble_yaml/lib)

---

<div class="post-metadata">

**Author:** ![RockyHawk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rockyhawk/32/14384_2.png) [@RockyHawk](https://discourse.processing.org/u/RockyHawk)\
**Post date:** [August 26, 2019, 2:22pm UTC](https://discourse.processing.org/t/yaml-file-editing/13602/3 "2019-08-26T14:22:22Z")

</div>

I also found this library that I downloaded [https://www.baeldung.com/java-snake-yaml](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.  
EDIT:  
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.  
[http://www.java2s.com/Code/Jar/b/Downloadbukkitjar.htm](http://www.java2s.com/Code/Jar/b/Downloadbukkitjar.htm)

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