Asdf.opIndex

Searches for a value recursively in an ASDF object.

struct Asdf
pure
opIndex
(
in char[][] keys...
)

Parameters

keys char[][]

list of keys keys Returns ASDF value if it was found (first win) or ASDF with empty plain data.

Examples

import asdf.jsonparser;
auto asdfData = `{"foo":"bar","inner":{"a":true,"b":false,"c":"32323","d":null,"e":{}}}`.parseJson;
assert(asdfData["inner", "a"] == true);
assert(asdfData["inner", "b"] == false);
assert(asdfData["inner", "c"] == "32323");
assert(asdfData["inner", "d"] == null);
assert(asdfData["no", "such", "keys"] == Asdf.init);

Meta