I would like to use a custom class on SignalR. But an client side I just get 'null' in the class.
Why am I getting such exceptions? Exception thrown: 'System.Text.Json.JsonException' in System.Text.Json.dll Exception thrown: 'System.IO.InvalidDataException' in Microsoft.AspNetCore.SignalR.Protocols.Json.dll
CodePudding user response:
It's likely your custom class isn't properly serializable as JSON.
CodePudding user response:
I found the problem. Need to use JsonConvert.SerializeObject and JsonConvert.DeserializeObject.