JSONValue floating and 42
Edwin van Leeuwen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 19 06:58:05 PDT 2016
On Tuesday, 19 April 2016 at 13:44:08 UTC, Andre wrote:
> -> I need to analyze every value whether it is a floating or an
> integer?
This is the correct option. Something like:
double f;
if (j["value"].type == JSON_TYPE.INTEGER)
f = j["value"].integer.to!float;
else
f = j["value"].floating;
There are also a number of libraries available that make dealing
with json a bit easier:
code.dlang.org/search?q=json
More information about the Digitalmars-d-learn
mailing list