BlackEdder / painlessjson

D library for converting any custom types to and from JSON the painless way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

null string will throw exception

mzfhhhh opened this issue · comments

struct P
{ string name; }

auto jv = parseJSON(`{"name": null}`);
auto j = fromJSON!P(jv); 

std.json.JSONException@std\json.d(136): JSONValue is not a string

Thanks for reporting.

Looking into it this should be fixed by returning T.init if JSON_TYPE == NULL here:
https://github.com/BlackEdder/painlessjson/blob/master/source/painlessjson/painlessjson.d#L615

Will try to do this in the next couple of days (PR's are welcome of course :) )