System.Text.Json easier config for read/deserialize number as string #104281
Unanswered
hsenasilva
asked this question in
Ideas
Replies: 1 comment
-
Isn't it covered by |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I was testing the System.Text.Json deserialization feature and I faced a scenario where double quoted number like "10.00" is parsed to System.Decimal by default on ASP.NET Core apps, and the opposite is not true. Which means that if we send an serialized decimal like 10.00 the default behavior is not the same, and the Converter will throw an exception. I think that could be useful an string implementation like JsonNumberHandling, where could be possible set an option on JsonSerializerOptions to permit parse automatically a number to string without the need to implement a custom converter.
What are your thoughts about this idea? Any side effects on this more permissive approach?
I could send an implementation proposal if you like the idea. o/
Beta Was this translation helpful? Give feedback.
All reactions