Dear Developers, I found four problems by using Tango Json.
PROBLEM 1: The method array in Json seems to be incorrect implemented.
Json!(char).Value[] values = null;
auto json = new Json!(char);
json.value = object(pair("array", array(values)));
The result is expected to be
{"array": []}
But it was
{"array": [null]}
PROBLEM 2: Parsing negative integer failed
auto json = new Json!(char);
json.parse(`{"jsonrpc":"2.0", "error": {"code": 32700, "message": "Parse error"}, "id": null}`); // PASSED
json.parse(`{"jsonrpc":"2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}`); // object.Exception: Expected " before member name
PROBLEM 3: Integer should not be converted to a Float.
In my application, I want to send a Json RPC error response, but the error code is coded as -32700.00 not -32700.
auto json = new Json!(char);
json.value = json.object(json.pair("code", json.value(-32700)));
// output -> {"code": -32700.00}
// expected -> {"code": -32700}
assert(json.value("code").toNumber == -32700); // PASSED
The function toNumber returns a float, but it is OK. We can convert it to the correct type easily.
But the string representation should not be a float. If we send Json string to other application in other language, it may be regarded as an error.
PROBLEM 4: Suggest to add a serialize method for Json
It is very inconvenience to print a Json object as string. We have to declare a delegate function first.
Thanks in advance