std.json

Andrea Fontana nospam at example.com
Sun Mar 25 10:50:43 PDT 2012


Hope it's clear...


import std.json;
import std.stdio;

void main(string args[])
{
         JSONValue json = parseJSON(q"EOS
{
         "key" :
         {
                 "subkey1" : "str_val",
                 "subkey2" : [1,2,3],
                 "subkey3" : 3.1415
         }
}
EOS");
         writeln(json.object["key"].object["subkey1"].str);
         
writeln(json.object["key"].object["subkey2"].array[1].integer);
         writeln(json.object["key"].object["subkey3"].type == 
JSON_TYPE.FLOAT);
}


On Sunday, 25 March 2012 at 15:26:31 UTC, AaronP wrote:
> Could I get a "hello, world" example of parsing json? The docs 
> look simple enough, but I could still use an example.



More information about the Digitalmars-d-learn mailing list