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

Handle null values while parsing double and float #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Szczurowsky
Copy link

When you try to parse JSON that has field with type (for ex.) double and value of that field is null, then it throws and exception.
That PR will allow such value for Double and Float, since they have value NaN that fits for that purpose.

@Szczurowsky Szczurowsky changed the title handle null values while parsing double and float Handle null values while parsing double and float Aug 30, 2024
@piotrrzysko
Copy link
Member

Thanks for the PR. A couple of comments:

  1. It would be good to add a test for this.
  2. I'm not sure why the parser should return NaN in this case. If a field is defined as float (not Float), and the JSON contains null for that field, it seems like an error that shouldn't be hidden.

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.

2 participants