Json.opIndex

Allows direct indexing of array typed JSON values.

  1. inout(Json) opIndex(size_t idx)
    struct Json
    @safe ref inout @trusted
    inout(Json)
    opIndex
    (
    size_t idx
    )
  2. const(Json) opIndex(string key)
  3. Json opIndex(string key)

Examples

Json value = Json.emptyArray;
value ~= 1;
value ~= true;
value ~= "foo";
assert(value[0] == 1);
assert(value[1] == true);
assert(value[2] == "foo");

Meta