mirror of
https://github.com/json-c/json-c.git
synced 2026-04-07 22:39:08 +08:00
Added a json_object_new_double_s() convenience function to allow an exact string representation of a double to be specified when creating the object and use it in json_tokener_parse_ex() so a re-serialized object more exactly matches the input.
Add json_object_free_userdata() and json_object_userdata_to_json_string() too.
This commit is contained in:
@@ -599,8 +599,10 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
goto out;
|
||||
}
|
||||
current = json_object_new_int64(num64);
|
||||
} else if(tok->is_double && json_parse_double(tok->pb->buf, &numd) == 0) {
|
||||
current = json_object_new_double(numd);
|
||||
}
|
||||
else if(tok->is_double && json_parse_double(tok->pb->buf, &numd) == 0)
|
||||
{
|
||||
current = json_object_new_double_s(numd, tok->pb->buf);
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_number;
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user