JSON.opIndex

Allows direct indexing of array typed JSON values.

  1. inout(JSON) opIndex(size_t idx)
    struct JSON
    @safe ref inout
    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