std.json cannot read an array floats back from file

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 2 14:12:48 PDT 2017


On Sunday, 2 July 2017 at 21:07:40 UTC, Yuri wrote:
> It is expected to print '2' in the console, however an 
> exception is thrown:
>
> std.json.JSONException@/build/ldc-I3nwWj/ldc-0.17.1/runtime/phobos/std/json.d(235): JSONValue is not a floating type


I think it just read the json string of "1" as being an integer 
instead of a float, so the reader thought it was integral instead 
of floating.

It should prolly just transparently auto-convert, but it doesn't 
seem to. Try accessing the int instead and see waht happens.



More information about the Digitalmars-d-learn mailing list