painlessjson released, looking for improvement advice

BlackEdder via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jan 29 05:16:47 PST 2015


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.



More information about the Digitalmars-d-announce mailing list