readArray

Reads an array and returns a lazy range of parser node ranges. * * The given parser node range must point to a node of kind * JSONParserNodeKind.arrayStart. Each of the returned sub ranges * corresponds to the contents of a single array entry. * * Params: * nodes = An input range of JSON parser nodes * * Throws: * A JSONException is thrown if the input range does not point to the * start of an array.

Examples

auto j = parseJSONStream(q{
        [
            "foo",
            "bar"
        ]
    });

size_t i = 0;
foreach (ref entry; j.readArray) {
    auto value = entry.readString;
    assert(entry.empty);
    switch (i++) {
        default: assert(false);
        case 0: assert(value == "foo"); break;
        case 1: assert(value == "bar"); break;
    }
}
assert(i == 2);

Meta