Uh oh!
There was an error while loading. Please reload this page.
Add JsonNumberHandling.AllowReadingFromString as a JsonSerializer web default - #41539
Conversation
Uh oh!
There was an error while loading. Please reload this page.
I assume this was requested by the ASP.NET team (@pranavkm can you verify)? I didn't see this ask in the two linked issues above. Update: per offline discussion, this was recommended during the API review and then discussed again offline with ASP.NET. |
Uh oh!
There was an error while loading. Please reload this page.
layomia
commented
Sep 2, 2020
Moving to 6.0 as the accompanying perf change I'd like to get in along with this PR will not meet the bar for back-porting to the .NET 5 release - #41679. |
layomia
commented
Sep 3, 2020
Test failures are unrelated: |
Changing such defaults is a breaking change, even if we are making things more forgiving, given these are default settings that folks will rely on, because being strict/validate on its own is a feature. If this leniency is important for Web, we should consider porting the change to 5.0 to avoid having to make a breaking change in the future. |
ericstj
commented
Sep 14, 2020
I believe @layomia is already doing this. |
… default (dotnet#41539) * Add JsonNumberHandling.AllowReadingFromString as a JsonSerializer web default * Add test assertion for number handling option in S.N.H.Json * Test number-as-string behavior in System.Net.Http.Json
layomia
commented
Oct 14, 2020
Filed a breaking change doc to advertise the significance of this change to ASP.NET Core apps - dotnet/docs#21067. |
ahsonkhan
commented
Oct 14, 2020
The |
ericstj
commented
Oct 14, 2020
@ahsonkhan, check out the doc issue that @layomia linked it explains it pretty well. |
Follow up from #39363 / #30255.
During API review for the number handling feature, it was discussed that number types being written as strings is a common pattern in many JSON producers (e.g API endpoints) across the web. Adding
JsonNumberHandling.AllowReadingFromStringas a web default makes it easier for .NET web applications to consume these numbers in a consistent manner (same options for client/shared/server).