I have created several POCO model classes, all of which have enums in them. I have several components (using hubs) which will display the models and update them. However, I cannot figure out how to get Blazor Server (.Net 8) setup properly in order to get the models sent properly from the server to the componenent – but I know it’s a serialization/deserialization issue. It seems that Blazor has changed how to setup/configure Json quite a bit over the past couple of years.
I’ve tried several different ways to get this to work (I’m new to Blazor) – can anyone offer any help on how to make json enum serialization/deserialization work properly??
The Microsoft docs and StackOverflow answers on this topic are very specific to versions before .Net 8, and the docs/answers reference files which do not exist in my current .Net 8 Web project (for instance, I do not have a Start.cs file – I only have Program.cs). Some of the answers suggested using an attribute like [JsonConverter(typeof(StringEnumConverter))] on the enum, or writing a custom json converter – but after trying them all, I still couldn’t make it work.
Any help would be greatly appreciated! Thanks!