JSONParser.getArray

Get a static array of elements matching the type.

  1. auto getArray()
  2. T[] getArray()
  3. T getArray()
    struct JSONParser
    T
    getArray
    (
    T : Element[Size]
    Element
    size_t Size
    )
    ()
  4. Element[Size] getArray()

Throws

JSONException if there's a type mismatch or syntax error.

Examples

auto text = q{ [1, 2, 3] };

{
    auto json = JSONParser(text);
    auto values = json.getArray!(uint[3]);

    static assert(is(typeof(values) == uint[3]));
    assert(values == [1, 2, 3]);
}

{
    auto json = JSONParser(text);
    auto values = json.getArray!(uint, 3);

    static assert(is(typeof(values) == uint[3]));
    assert(values == [1, 2, 3]);

}

Meta