-
Notifications
You must be signed in to change notification settings - Fork 41
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 option to parse quoted numbers #156
Comments
If you know for certain that a number is quoted, you can take a look at https://github.com/Tornhoof/SpanJson/blob/master/SpanJson.Tests/CustomSerializerTests.cs This test has a custom quoted long formatter. For the case where you need to handle both at runtime this is not that easy to solve efficiently |
This only work when numbers are always quoted, and to support both quoted and not I'm ending up with two classes anyway (which I was trying to avoid - real structure is the same, only format differs). |
I've implemented this as we also get bad formatted json, and we don't know whether numbers will be quoted or not. We're using it in production, but I'd rather get the bad json fixed when we can. The change is rather simple, it's just processing quotes inside ReadUtf8NumberInternal() and ReadUtf8NumberDigits() (and probably the Utf16 versions too, but we're not using those). This library is really good, so thank you!!! |
It would be great if such option will be implemented.
Often external services provide json data not really caring whether numbers are quoted or not, and this results in more complicated code to support it.
Microsoft added it too in System.Text.Json some time ago (dotnet/runtime#30255)
The text was updated successfully, but these errors were encountered: