-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Inconsistency of System.Text.Json behavior between .NET Framework and .NET Core #30666
Comments
cc: @tannergooding |
As I understand it, we use "G17" on full framework as part of this change dotnet/corefx#38322 since the defaults produce fewer strings that round-trip. I believe the inconsistency you observed is expected due to the limitations in netfx (https://github.com/dotnet/corefx/issues/40406#issuecomment-522552006). |
@tannergooding can you confirm this is by-design? |
Yes, this is by design; as per my explanation in the comment(s) @ahsonkhan linked to above. |
JsonSerializer.Serialize
works differently withdouble
depending on target.I wrote simple test to check
System.Text.Json
behavior comparing toNewtonsoft.Json
Results
For some reason
JsonSerializer.Serialize
roundsdouble
when it exceeds 17 digits, butJsonConvert.Serialize
doesn't.I have ASP.NET Core Web API which is sending good JSON provided by
System.Text.Json
and this JSON is being deserialized on .NET Framework without problems so the problem is only withJsonSerializer.Serialize
The text was updated successfully, but these errors were encountered: