painlessjson released, looking for improvement advice

Pierre Krafft via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jan 29 12:04:50 PST 2015


On Thursday, 29 January 2015 at 18:47:37 UTC, Rory McGuire wrote:
> :) I use jsvar for any JSON work in D. Javascript is the only 
> thing I've
> used that is possibly easier to work with JSON values.
>
> https://github.com/adamdruppe/arsd/blob/master/jsvar.d
>
>
> On Thu, Jan 29, 2015 at 5:18 PM, BlackEdder via 
> Digitalmars-d-announce <
> digitalmars-d-announce at puremagic.com> wrote:
>
>> On Thursday, 29 January 2015 at 14:05:25 UTC, Chris wrote:
>>
>>>
>>> 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.
>>>
>>
>> Painlessjson in many ways abstracts away the std.json 
>> implementation, so
>> using it you should rarely/never have to use std.json 
>> directly. It
>> basically abstracts away most of the complexity and you should 
>> only ever
>> have to use toJSON and fromJSON. This works with built-in types
>> (double/int/string etc.) and also with ranges and associative 
>> arrays.
>>
>> On top of that Painlessjson also makes it easy to convert your 
>> own
>> types/struct/classes to and from JSON by (de)serializing them 
>> automatically
>> (as far as possible).
>>
>> If a better simpler std.json gets developed then we can rebase
>> painlessjson on that and it might become a thinner wrapper, 
>> but I would
>> expect the (de)serialization still to be useful in many cases.

It's fun to see that there are so many different solutions to 
working with JSON in D. jsvar seems to be for keeping your 
variables in JavaScript-land, something I think is a bad idea in 
most cases. The idea of painlessjson is to convert to native D as 
fast as possible. The goal is to get something like 
https://github.com/FasterXML/jackson for D.
We are still looking for input on how inheritance and 
constructors should work.


More information about the Digitalmars-d-announce mailing list