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 JsonGenerator.copyCurrentEventExact as alternative to copyCurrentEvent() #984

Closed
cowtowncoder opened this issue Apr 7, 2023 · 1 comment
Labels
2.15 Issue planned (at earliest) for 2.15
Milestone

Comments

@cowtowncoder
Copy link
Member

(note: this will replace #730 )

There is an existing problem with JsonGenerator.copyCurrentEvent() as explained on issue #730.
Unfortunately changing existing implementation has potential serious downsides for usage with binary backends when translating from textual format like JSON (with possible but not necessarily inexact double vs accurate BigDecimal) into binary format like CBOR, where latter may desire to just use double (or float) value.

Since we do want to offer a way for 100% accuracy-retaining method, it seems safer to introduce a new method as an alternative so caller can specify exactly what to optimize for -- existing method follows whatever JsonParser.getNumberType() claims is the optimal representation; new method will instead use JsonParser.getNumberValueExact().

NOTE: we may consider in near future possibly to add JsonGenerator.copyCurrentStructureExact(), but initial work is just for copyCurrentEventExact().

@cowtowncoder
Copy link
Member Author

Implemented; changed unit test added for #730 to verify new method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.15 Issue planned (at earliest) for 2.15
Projects
None yet
Development

No branches or pull requests

1 participant