Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add char * representation of JSONNumber to handle bigints #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0x416e746f6e
Copy link

@0x416e746f6e 0x416e746f6e commented Apr 26, 2023

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)

@kgabis
Copy link
Owner

kgabis commented Apr 27, 2023

Hi, at first glance this looks okay, I'll check it more thoroughly when I have some spare time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants