-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
This is an issue found while upgrading to System.Text.Json in Asp.NET Core 3.1. We have two webservices which interact based on Json contract.
When webservice1 based on ASP.NET Core, serializes using System.Text.Json a data with datatype double with value 312.0 is passed to Python webservice, we expect serialization to have double value, but this is not the case with System.Text.Json.
This double value is serialized as int value which is causing our webservice2 to treat it as int value 312 and causing variation in floating point results.
This was working perfectly fine with Newtonsoft.Json, as it treats double value 312.0 on serialization to be 312.0
I have uploaded the repo in this link:
https://github.com/minato7/IssueSystemTextJsonDouble
My assumption is if a contract has double datatype, it should be treated as double upon serialization and if it converts to int datatype this is an unexpected behavior, there should be an option provided to treat this double like FloatParseHandling in Newtonsoft.Json to achieve this behavior in System.Text.Json.