Bug in std.json or my problem

CraigDillabaugh craig.dillabaugh at gmail.com
Wed Apr 22 18:35:49 UTC 2020

On Wednesday, 22 April 2020 at 18:23:48 UTC, Anonymouse wrote:
> On Wednesday, 22 April 2020 at 17:48:18 UTC, Craig Dillabaugh 
> wrote:
>> The crash is caused because the 'income' field with value 0.0 
>> is
>> output as 0 (rather than 0.0) and when it is read this is 
>> interpreted
>> as an integer.
>> Shouldn't this work?
> Yes, it's just buggy.
> Giving it a value of an even 1.0 will make it throw the same 
> exception (js["income"].type is JSONType.integer), but a value 
> of 1.1 will make it pass (.type properly becomes 
> JSONType.float_).
> I don't know of a solution other than to check 
> js["income"].type beforehand and use .floating or .integer as 
> befits, or simply use an alternative JSON library (asdf?).
> File an issue if you have the time, maybe it will get 
> attention. Unreported bugs can only be fixed by accident.

I thought it might be worth filing a bug, but wanted to confirm 
if others thought this was actually a bug.  I had encountered an 
identical issue with vibe-d years ago.

Thanks for the feedback.

More information about the Digitalmars-d-learn mailing list