std.json cannot read an array floats back from file

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 3 07:04:47 PDT 2017


Yuri wrote:

> On Sunday, 2 July 2017 at 21:15:41 UTC, ketmar wrote:
>> so, write your own wrapper that will convert INTEGER/UINTEGER/FLOAT to 
>> `double`. i think this is the best solution (if there can be "best 
>> solution" with std.json at all).
>
> I share your sentiment in relation to std.json, ketmar.
>
> On a side note, what would be a better way to serialize/deserialize 
> objects in D if std.json does not cut it? It does not have to be JSON 
> serialization although would be preferred.

it depends of the types of your objects. simple json-like (de)serializer 
for objects with fixed layout can be done in very small amount of code[0]. 
that's what i am using (and it can *read* json into structs too, i'm 
actually using it to parse some jsons -- idgames API replies, for example).

[0] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/txtser.d


More information about the Digitalmars-d-learn mailing list