deserializeValue

Deserialize numeric value.

More...

Detailed Description

Special deserialisation string values

"+NAN"
"+NaN"
"+nan"
"-NAN"
"-NaN"
"-nan"
"NAN"
"NaN"
"nan"
"+INF"
"+Inf"
"+inf"
"-INF"
"-Inf"
"-inf"
"INF"
"Inf"
"inf"

Examples

import std.bigint;

assert(deserialize!ulong (serializeToAsdf(20)) == ulong (20));
assert(deserialize!ulong (serializeToJson(20)) == ulong (20));
assert(deserialize!double(serializeToAsdf(20)) == double(20));
assert(deserialize!double(serializeToJson(20)) == double(20));
assert(deserialize!BigInt(serializeToAsdf(20)) == BigInt(20));
assert(deserialize!BigInt(serializeToJson(20)) == BigInt(20));

assert(deserialize!float (serializeToJson ("2.40")) == float (2.40));
assert(deserialize!double(serializeToJson ("2.40")) == double(2.40));
assert(deserialize!double(serializeToAsdf("-2.40")) == double(-2.40));

import std.math : isNaN, isInfinity;
assert(deserialize!float (serializeToJson  ("+NaN")).isNaN);
assert(deserialize!float (serializeToJson  ("INF")).isInfinity);
assert(deserialize!float (serializeToJson ("-inf")).isInfinity);

Meta