dyaml/examples/getting_started/main.d
Cameron Ross e37c4daa7e switch to a non-templated Dumper struct (#234)
switch to a non-templated Dumper struct
merged-on-behalf-of: Basile-z <Basile-z@users.noreply.github.com>
2019-02-07 08:48:50 +01:00

19 lines
407 B
D

import std.stdio;
import dyaml;
void main()
{
//Read the input.
Node root = Loader.fromFile("input.yaml").load();
//Display the data read.
foreach(string word; root["Hello World"])
{
writeln(word);
}
writeln("The answer is ", root["Answer"].as!int);
//Dump the loaded document to output.yaml.
dumper().dump(File("output.yaml", "w").lockingTextWriter, root);
}