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.

Reply via email to