-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I am sorry that my English is so bad.
I'm using json-c 0.13.1.
If set negative double value, it will be formatted without including ".0".
Is this correct?
Line 23 in 3e81b4a
* PR#394: fix handling of custom double formats that include a ".0" |
code:
struct json_object* json_obj = json_object_new_object();
struct json_object* positive_double_json_obj = json_object_new_double(12e+4);
struct json_object* negative_double_json_obj = json_object_new_double(-12e+4);
json_object_object_add(json_obj, "positive", positive_double_json_obj);
json_object_object_add(json_obj, "negative", negative_double_json_obj);
std::cout << "--- convert to string ---" << std::endl;
std::cout << json_object_to_json_string(json_obj) << std::endl;
std::cout << "-------------------------" << std::endl;
result:
--- convert to string ---
{ "positive": 120000.0, "negative": -120000 }
-------------------------
Metadata
Metadata
Assignees
Labels
No labels