std.json

Jarl André" <jarl.andre at gmail.com> Jarl André" <jarl.andre at gmail.com>
Thu May 17 11:55:56 PDT 2012


On Thursday, 17 May 2012 at 18:36:22 UTC, Jarl André wrote:
> On Thursday, 17 May 2012 at 14:08:27 UTC, Vincent wrote:
>> On Sunday, 25 March 2012 at 17:50:45 UTC, Andrea Fontana wrote:
>>> Hope it's clear...
>>
>> Nope, it's something like chess and have nothing common with 
>> simplicity of the real JSON usage! This is example from C#:
>>
>> var p = JsonConvert.DeserializeObject<Person>("{some real 
>> JSON, not crapy EOS}");
>> var str = JsonConvert.SerializeObject(p);
>>
>> That's it! And this is how it SHOULD be implemented. Cannot 
>> catch why this stupid realization came to standard library... 
>> :((
>
> I'm pretty new to D, but I am an expert Java developer, self 
> claimed. I am fluent in many other languages as well. In all 
> languages there is a basis documentation.
>
> Read the documentation for parseJSON and you'll see that it 
> should be possible to send in a straight JSON string. I think 
> the complex example is a bit stupid. It scares developers away 
> from the lang.
>
> Feel free to correct me of course.

The final proof of exisiting simplicity :)

JSONValue[string] value = parseJSON("{ \"test\": \"1\"
}").object;
writeln(value["test"].str);

This outputs "1"


More information about the Digitalmars-d-learn mailing list