painlessjson released, looking for improvement advice

Pierre Krafft via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jan 29 05:44:03 PST 2015


On Thursday, 29 January 2015 at 13:16:48 UTC, BlackEdder wrote:
> On Thursday, 29 January 2015 at 00:24:44 UTC, rlonstein wrote:
>>
>> Not quite the same, but I've been using dson
>> (https://github.com/w0rp/dson).
>>
>> Have you looked it over?
>>
>
> Did not know about that one. From looking through the source it 
> seems to have a different goal though. dson looks like it is an 
> alternative to std.json. Painlessjson is meant to make it 
> easier to use json, by automatically (de)serializing 
> objects/structs and converting them to (and from) json.
>
> For example:
> class Point
> {
>   double x;
>   double y;
> }
>
> void main()
> {
>   auto pnt = new Point( 1,2 );
>   auto jsonPnt = toJSON( pnt ); // Returns a JSONValue( "{ "x": 
> 1.0, "y": 2.0 }" )
>   auto nPnt = fromJSON!Point( jsonPnt );
>   assert( nPnt.x == pnt.x && nPnt.y == pnt.y );
> }
>
> I guess it would be interesting to use dson instead of std.json 
> as a basis for Painlessjson.

I believe we should continue using std.json, and instead push for 
taking dson (or its lessons learned) into phobos if it's a better 
implementation. The best general solution should be the one that 
is available out of the box.


More information about the Digitalmars-d-announce mailing list