painlessjson released, looking for improvement advice
Chris via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Thu Jan 29 06:05:24 PST 2015
On Thursday, 29 January 2015 at 13:44:04 UTC, Pierre Krafft wrote:
> 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.
Yeah, I was wondering, if you have to import std.json and use it
as a basis for painlessjson, is it really so big an improvement?
Especially since std.json might be replaced (sooner or later).
I'd prefer an "easy to use" implementation that replaces std.json
completely.
(I don't want to slight the work done on painlessjson and it
might come in handy here and there. Maybe it could be added to
the std.json module?)
More information about the Digitalmars-d-announce
mailing list