Open
Description
background
currently the real big problem for people to switch from Newtonsoft.json to System.Text.json is that the S.T.J to too strict on deserialzing.
the bigest problem for me is the string <===> number
, currently there is a JsonNumberHandling.AllowReadingFromString
option for string ==> json
, but not reverse, and WriteAsString
is for serializing.
why you read a json number to a string property?
the user case for this is primary for 3rd party interface or compatibility.
- the remote 3rd party has a week languge, and use
string|number
for a json property - or a system begin as
number
type , and then addstring
type , and for compatibility, the model for receive the json change fromint
=> 'string'
using newtonsoft.json this is very simple , because newtonsoft.json allow string to accept any type in json, but for System.Text.Json, this must change type from int
=> JsonNode
and involve json framework type
suggestion
JsonNumberHandling.AllowReadingFromString
should also allow read number to string