Object not properly deserialized due to case-sensitivity
See original GitHub issueHi!
First of all, thanks for the library! It’s great to have possibility to use SignalR in Blazor with C#.
I have an issue with deserialization of an object. There’s an example code attached.
On client side I changed the Index component to subscribe to a hub and added a button to poke a controller on server side that sends an object through the hub.
Problem is, that all strings are empty in the object received in the client in method registered through .On<>
(OnPostReceived
). The contents of the received message is logged to console:
When I looked at the packets through Wireshark they seemed to contain sensible data.
It’s also possible that I’m doing something very wrong.
I’m using strongly-typed hub on the server, but I don’t think it should matter.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
@dave-bt To work around the problem before the fix is released you can force the Json serializer to always use lowercase property names like that:
You may need to add reference to the
System.Text.Json
package however if your class is located innetstandard2.1
project (default with Blazor .Shared projects):Yes, the current
System.Text.Json
requires you to useJsonPropertyName
.