indeed,only in debugger it is shown as null,but in Console.WriteLine it is ok
Null and empty string are not the same types. The serializer does NOT convert an empty string to null. You must be missing something. Share code that reproduces this issue so we can figure out what's going on.
Member
11 Points
73 Posts
System.Text.Json Deserialize empty strings to null
Oct 24, 2020 11:37 AM|moris27|LINK
Hi
using Blazor 3.2,is there any option not to convert empty strings to null on System.Text.Json Deserialize?
All-Star
52221 Points
23292 Posts
Re: System.Text.Json Deserialize empty strings to null
Oct 24, 2020 12:32 PM|mgebhard|LINK
Empty string are not converted to null. Null is converted to null.
Results
Member
11 Points
73 Posts
Re: System.Text.Json Deserialize empty strings to null
Oct 24, 2020 01:28 PM|moris27|LINK
indeed,only in debugger it is shown as null,but in Console.WriteLine it is ok
thanks
All-Star
52221 Points
23292 Posts
Re: System.Text.Json Deserialize empty strings to null
Oct 24, 2020 01:37 PM|mgebhard|LINK
Null and empty string are not the same types. The serializer does NOT convert an empty string to null. You must be missing something. Share code that reproduces this issue so we can figure out what's going on.
Member
11 Points
73 Posts
Re: System.Text.Json Deserialize empty strings to null
Oct 24, 2020 01:59 PM|moris27|LINK
It's ok,only Blazor client-side debugging with Chrome shows null
post can be deleted
thanks