parseJSONValue

* Parses a stream of JSON tokens and returns the result as a JSONValue. * * All tokens belonging to the document will be consumed from the input range. * Any tokens after the end of the first JSON document will be left in the * input token range for possible later consumption.

  1. JSONValue parseJSONValue(Input input, string filename, int maxDepth)
  2. JSONValue parseJSONValue(Input tokens, int maxDepth)
    @safe
    parseJSONValue
    (
    Input
    )
    (
    ref Input tokens
    ,)

Examples

// lex
auto tokens = lexJSON(`[1, 2, 3]`);

// parse
auto doc = parseJSONValue(tokens);

auto arr = doc.get!(JSONValue[]);
assert(arr.length == 3);
assert(arr[0] == 1.0);
assert(arr[1] == 2.0);
assert(arr[2] == 3.0);

Meta