funkwerk.stdx.data.json.value

Defines a generic value type for builing and holding JSON documents in memory.

Members

Functions

opt
auto opt(JSONValue val)

Allows safe access of sub paths of a JSONValue.

Structs

JSONValue
struct JSONValue

* Represents a generic JSON value. * * The JSONValue type is based on std.variant.Algebraic and as such * provides the usual binary and unary operators for handling the contained * raw value. * * Raw values can be either null, bool, double, string, * JSONValue[] or JSONValue[string].

WrappedBigInt
struct WrappedBigInt

Proxy structure that stores BigInt as a pointer to save space in JSONValue

Examples

// build a simple JSON document
auto aa = ["a": JSONValue("hello"), "b": JSONValue(true)];
auto obj = JSONValue(aa);

// JSONValue behaves almost as the contained native D types
assert(obj["a"] == "hello");
assert(obj["b"] == true);

Meta

Authors

Sönke Ludwig