You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @mraasvel - sorry for the really slow response. I added a test in #32 to confirm our behavior currently matches upstream. This repo is meant to be just a performance optimization of the upstream marshaller and we don't want to add features independently - while it's possible if there is a Jackson-specific mechanism, as you found it seems Jackson also doesn't allow configuring this at the JsonParser level. So my recommendation is if this is important, to file an issue upstream to see if they would add an option to disable implicit conversion. If they do, we'll add it here. How does that sound?
Actually, I realized your issue may be less about preventing the implicit conversion and more about making sure the result isn't rounded. In #33, I updated to use your exact input and verified it behaves the same as upstream by parsing an unrounded value. Can you compare your code with the test case to see what could be causing you to see a different result?
Hello,
I was wondering about your opinion on possible adding some kind of configuration option to disallow implicit conversions.
Explanation
Given a JSON like this, where the value of
key
is a floating point number:But we explicitly expect a string, since implicit conversion can cause rounding issues
Expected behavior:
Parsing fails with an error since the JSON type does not match the expected type
Actual behavior:
Parser implicitly parses the value as a float and converts the result to a String, resulting in unwanted rounding:
This is because all of the Jackson
JsonParser
implementations do implicit conversions if asked for that particular value: https://groups.google.com/g/jackson-user/c/_VNLt7LYupIThe text was updated successfully, but these errors were encountered: