When JSON-encoding a float denoting a whole number, the number is encoded as an integer. Consider the following example: void main() { auto jv1 = JSONValue(4.0); auto textual = jv1.toString(); auto jv2 = parseJSON(textual); writeln(jv1.type); // FLOAT writeln(textual); // "4" writeln(jv2.type); // INTEGER } This is due to the following code in std.json.toJSON: case JSON_TYPE.FLOAT: json.put(to!string(value.store.floating)); break; to!string(4.0) returns "4", disregarding the fact it was a float. A simple fix would be to append ".0" if the string representation does not contain a dot. This currently breaks my code, where I expect a value to be a floating point number, but I have to try getting it either as an integer or a float.
There's a pull for the most recent dup so it's more simple to close this one. *** This issue has been marked as a duplicate of issue 16432 ***