dyaml/examples/getting_started/main.d
Cameron Ross 8e0ca41eb5 Replace stream-based dumping interface with an outputrange-based interface (#154)
Replace stream-based dumping interface with an outputrange-based interface
merged-on-behalf-of: Cameron Ross <elpenguino@gmail.com>
2018-06-22 05:59:10 +02:00

19 lines
405 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(File("output.yaml", "w").lockingTextWriter).dump(root);
}