fromJSON

Extract a numeric type from a json value.

Examples

Extract various numeric types.

assert(JSONValue(1).fromJSON!int      == 1);
assert(JSONValue(2u).fromJSON!uint    == 2u);
assert(JSONValue(3.0).fromJSON!double == 3.0);

// fromJSON accepts numeric strings when a numeric conversion is requested
assert(JSONValue("4").fromJSON!long   == 4L);

Meta