mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 15:10:46 +03:00
Issue 13013 - Converted real to double in std.json.JSONValue
This commit is contained in:
parent
8221ed4c4b
commit
333e7e734f
1 changed files with 5 additions and 5 deletions
10
std/json.d
10
std/json.d
|
@ -58,7 +58,7 @@ struct JSONValue
|
||||||
string str;
|
string str;
|
||||||
long integer;
|
long integer;
|
||||||
ulong uinteger;
|
ulong uinteger;
|
||||||
real floating;
|
double floating;
|
||||||
JSONValue[string] object;
|
JSONValue[string] object;
|
||||||
JSONValue[] array;
|
JSONValue[] array;
|
||||||
}
|
}
|
||||||
|
@ -161,14 +161,14 @@ struct JSONValue
|
||||||
|
|
||||||
/// Value getter/setter for $(D JSON_TYPE.FLOAT).
|
/// Value getter/setter for $(D JSON_TYPE.FLOAT).
|
||||||
/// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.FLOAT).
|
/// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.FLOAT).
|
||||||
@property inout(real) floating() inout
|
@property inout(double) floating() inout
|
||||||
{
|
{
|
||||||
enforceEx!JSONException(type == JSON_TYPE.FLOAT,
|
enforceEx!JSONException(type == JSON_TYPE.FLOAT,
|
||||||
"JSONValue is not a floating type");
|
"JSONValue is not a floating type");
|
||||||
return store.floating;
|
return store.floating;
|
||||||
}
|
}
|
||||||
/// ditto
|
/// ditto
|
||||||
@property real floating(real v)
|
@property double floating(double v)
|
||||||
{
|
{
|
||||||
assign(v);
|
assign(v);
|
||||||
return store.floating;
|
return store.floating;
|
||||||
|
@ -299,7 +299,7 @@ struct JSONValue
|
||||||
* be copied.
|
* be copied.
|
||||||
* Otherwise, $(D arg) must be implicitly convertible to one of the
|
* Otherwise, $(D arg) must be implicitly convertible to one of the
|
||||||
* following types: $(D typeof(null)), $(D string), $(D ulong),
|
* following types: $(D typeof(null)), $(D string), $(D ulong),
|
||||||
* $(D long), $(D real), an associative array $(D V[K]) for any $(D V)
|
* $(D long), $(D double), an associative array $(D V[K]) for any $(D V)
|
||||||
* and $(D K) i.e. a JSON object, any array or $(D bool). The type will
|
* and $(D K) i.e. a JSON object, any array or $(D bool). The type will
|
||||||
* be set accordingly.
|
* be set accordingly.
|
||||||
*/
|
*/
|
||||||
|
@ -644,7 +644,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T)
|
||||||
if(isFloat)
|
if(isFloat)
|
||||||
{
|
{
|
||||||
value.type_tag = JSON_TYPE.FLOAT;
|
value.type_tag = JSON_TYPE.FLOAT;
|
||||||
value.store.floating = parse!real(data);
|
value.store.floating = parse!double(data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue