Re: JSONValue floating and 42

2016-04-19 Thread Andre via Digitalmars-d-learn
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)

Re: JSONValue floating and 42

2016-04-19 Thread Edwin van Leeuwen via Digitalmars-d-learn
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; T

JSONValue floating and 42

2016-04-19 Thread Andre via Digitalmars-d-learn
Hi, I have to deal with a JSON like this [{"value":42},{"value":1e+100}] Value is a floating number, but the providing system does not write 42 as 42.00. While trying to get the value with .floating, I get an exception because 42 is not a floating value. I try to understand what is the issue