On Wednesday, 14 October 2015 at 07:35:49 UTC, Marco Leise wrote:
Example:

    double x = 0, y = 0, z = 0;
auto json = parseTrustedJSON(`{ "coordinates": [ { "x": 1, "y": 2, "z": 3 }, … ] }`);

    foreach (idx; json.coordinates)
    {
// Provide one function for each key you are interested in
        json.keySwitch!("x", "y", "z")(
                { x += json.read!double; },
                { y += json.read!double; },
                { z += json.read!double; }
            );
    }

How can `coordinates` member be known at compile-time when the input argument is a run-time string?

Reply via email to