std.json

Shammah Chancellor anonymous at coward.com
Wed Nov 13 12:24:44 PST 2013


On 2012-05-17 14:08:26 +0000, Vincent said:

> 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... :((

This is planned in the upgrade to std.json which is currently being 
developed.   However, you'll note that you cannot parse generic JSON 
that way ( since you need a defined type "Person").   The current 
parseJSON is really a different feature from what exists in your 
example, and was implemented before opDispatch was introduced.   C# has 
a similar feature to deserialize JSON into ExpandoObjects, but that's 
also different from your example.



More information about the Digitalmars-d-learn mailing list