parson icon indicating copy to clipboard operation
parson copied to clipboard

Add `char *` representation of `JSONNumber` to handle `bigint`s

Open 0x416e746f6e opened this issue 1 year ago • 1 comments

Presently parson converts all JSON's number values into a double. This means that large bigint (a.k.a. long long) values will loose least significant digits (e.g. 35506143 will end up as 3.55061e+07). In order to still be able to have the "loss-less" representation of the input JSON value, let's keep both double and char * versions of it.

This PR implements the above feature, and particularly introduces the following functions:

  • const char * json_value_get_number_as_string (const JSON_Value *value)
  • JSON_Value * json_value_init_number_as_string (const char *number)

0x416e746f6e avatar Apr 26 '23 15:04 0x416e746f6e