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

Fix negative zero #188

Merged
merged 7 commits into from
Jan 30, 2016
Merged

Fix negative zero #188

merged 7 commits into from
Jan 30, 2016

Conversation

johnjaylward
Copy link
Contributor

Fixes #187 -0 now returns as a double.

@johnjaylward
Copy link
Contributor Author

test cases submitted

@stleary
Copy link
Owner

stleary commented Jan 28, 2016

What problem does this code solve?
Parser should follow the JSON spec and produce numeric values from '-0' and '-0.0'
This is a user-found defect. See issue #187.

Changes to the API?
XML.stringToValue(String) is deprecated in favor of JSONObject.stringToValue(String)

Changes to how the code behaves?
Negative zero strings are now parsed to Double instead of String.

Does it break the unit tests?
No, but new unit tests will be committed after this code is committed. See stleary/JSON-Java-unit-test#39.

Will this require a new release?
No, I am proposing for this change to be rolled into the next release. If you disagree, please
post in this thread

Should the documentation be updated?
No.

@johnjaylward
Copy link
Contributor Author

-0 and -0.0 both parse to Double since Long/Integer would lose the sign.

@stleary
Copy link
Owner

stleary commented Jan 28, 2016

Got it, thanks.

@coderextreme
Copy link

This fixed over 6300 instances in our JSON documents. Thanks everyone for the effort.

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.

3 participants