std.json

AaronP aaronbpaden at gmail.com
Sun Mar 25 11:12:02 PDT 2012


On 03/25/2012 12:50 PM, Andrea Fontana wrote:
> 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.
>

Ah. That's perfect, thanks. :)


More information about the Digitalmars-d-learn mailing list