JSONValue floating and 42

Andre via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 19 11:27:58 PDT 2016


On Tuesday, 19 April 2016 at 13:58:05 UTC, Edwin van Leeuwen 
wrote:
> 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

I will do so. Thanks.

Kind regards
André


More information about the Digitalmars-d-learn mailing list