Target type. can be any primitive/builtin D type, or any user-defined type using the JsonizeMe mixin.
JSONValue to deserialize.
key of desired value within the object.
configures the deserialization behavior.
Directly extract values from an object by their keys.
auto aa = ["a": 1, "b": 2]; auto json = JSONValue(aa); assert(json.fromJSON!int("a") == 1); assert(json.fromJSON!ulong("b") == 2L);
Deserialize an instance of a user-defined type from a json object.
import jsonizer.jsonize; static struct Foo { mixin JsonizeMe; @jsonize int i; @jsonize string[] a; } auto foo = `{"i": 12, "a": [ "a", "b" ]}`.parseJSON.fromJSON!Foo; assert(foo == Foo(12, [ "a", "b" ]));
Extract a value from a json object by its key.
Throws if json is not of JSONType.object or the key does not exist.