Fastest JSON parser in the world is a D project

Nordlöw via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Oct 26 13:04:32 PDT 2015


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?


More information about the Digitalmars-d-announce mailing list