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

Fixes JSON down converter decimal spec issue. #134

Merged
merged 3 commits into from
Nov 5, 2021

Conversation

cheqianh
Copy link
Contributor

@cheqianh cheqianh commented Nov 5, 2021

Description:

Ion allows 2.d-1 indicating 0.2 while JSON doesn't. When IonDoNet JSON downconverter converts 2.d-1 to JSON decimal, it returns 2.e-1 which is an invalid JSON decimal since exponent e can't follow . directly. Refer to JSON spec for more details.

So IonDotNet JSON down converter should return a valid JSON decimal (e.g. 2e-1).

 
 
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@cheqianh cheqianh requested a review from tgregg November 5, 2021 04:57
Copy link
Contributor

@tgregg tgregg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work, but before merging I recommend looking into one alternative solution, which is to never write a decimal point immediately before d or e, even in text Ion. I don't believe it's ever required, and is therefore just a waste of a character. It looks like this decimal point is added in BigDecimal.ToString here.

@cheqianh
Copy link
Contributor Author

cheqianh commented Nov 7, 2021

Opened an issue #136 for Tyler's comment.

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