std.json parsing issues

GrimMaple grimmaple95 at gmail.com
Wed Nov 6 21:48:48 UTC 2019


Hello everyone! I'm fairly new to D and don't know much about its 
internals, but I've been playing around with std.json and found 
out a pretty weird behaviour in it. Let's say I have a JSON like 
this: { "Value": 123 }. When I parse it and try to 
writeln(json["Value"].floating) it throws a runtime error saying 
that "Value" is not "floating". I understand that it's being 
taken as an integer, but aren't integers subset of decimals? I 
would expect it to be able to convert to float no problem, but 
it's not the case. Does anyone know if this behaviour is intended 
or if it's a bug?


More information about the Digitalmars-d mailing list