Asynchronous I/O that doesn’t get in your way, written in D
Module vibe.data.bson
BSON serialization and value handling.
Example
void manipulateBson(Bson b)
{
import std.stdio;
// retrieving the values is done using get()
assert(b["name"].get!string == "Example");
assert(b["id"].get!int == 1);
// semantic conversions can be done using to()
assert(b["id"].to!string == "1");
// prints:
// name: "Example"
// id: 1
foreach (string key, value; b)
writefln("%s: %s", key, value);
// print out with JSON syntax: {"name": "Example", "id": 1}
writefln("BSON: %s", b.toString());
// DEPRECATED: object members can be accessed using member syntax, just like in JavaScript
//j = Bson.emptyObject;
//j.name = "Example";
//j.id = 1;
}