Created
April 3, 2016 20:11
-
-
Save rdmueller/545286b23c76a80906f356d66ffa199e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple script which shows how to read and write YAML with Groovy | |
@Grab("org.yaml:snakeyaml:1.16") | |
import org.yaml.snakeyaml.Yaml | |
def yamlData = """ | |
Time: 2001-11-23 15:01:42 -5 | |
User: a Test | |
# Multiline String | |
Warning: | |
This is an error message | |
for the log file | |
Boolean: True | |
address: | |
street: sesamestreet 5 | |
city: Hollywood | |
""" | |
def dataFromYaml = new Yaml().load(yamlData) | |
println dataFromYaml | |
Yaml yaml = new Yaml(); | |
println yaml.dumpAsMap(dataFromYaml) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment