painlessjson released, looking for improvement advice

Pierre Krafft via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Jan 28 13:54:05 PST 2015


Hi,
DUB lacked a package for going between D objects and JSON.
painlessjson is a library just released on DUB looking to be the 
easy solution for converting D data to and from JSON.

painlessjson uses templates and traits to generate code that 
converts to and from std.json.

The goals of painlessjson are:
- Easy to use and set up
- Highly configurable with sensible defaults
- Keep the library code simple by not reinventing what others 
provide for us
- Support as many D types as possible

Current features are:
- Convert to and from std.json, structs and classes with default 
constructor, arrays, associative arrays, and any type 
implementing _toJSON + _fromJSON.
- Includes @property functions
- Ignore a field using @SerializeIgnore
- Rename a field using @SerializedName("Name") or 
@SerializedToName('To') @SerializedFromName('From')

This project gained momentum just recently so there are several 
things to improve. We want input and help to make this as great 
as possible.
The features that are being designed right now are quite tricky 
to get right so any help would be greatly appreciated.

The project is on github: 
https://github.com/BlackEdder/painlessjson
And on DUB: http://code.dlang.org/packages/painlessjson

Our current issues are:
- How do we support subclasses? 
https://github.com/BlackEdder/painlessjson/issues/8
- How should constructors be handled? Don't forget alias this and 
preferably find the best constructor to use without relying on 
annotations. https://github.com/BlackEdder/painlessjson/issues/12


More information about the Digitalmars-d-announce mailing list