© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
13 replies
Will Pittenger

✅ How to deserialize JSON in .NET when my base class is generic?

I have a concrete class,
ClientEventInfo
ClientEventInfo
derived from a generic. So I tried to deserialize a JSON file with
System.Text.Json.JsonSerializer.Deserialize<ClientEventInfo>("url")
System.Text.Json.JsonSerializer.Deserialize<ClientEventInfo>("url")
, but I get
System.TypeInitializationException
System.TypeInitializationException
. Seems the generic can't be initialized. Is there a way around it? I don't know what's going on here.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ JSON Deserialize Derived Class
C#CC# / help
2y ago
✅ Refering to Generic Base Class
C#CC# / help
3y ago
❔ How does ASP.NET deserialize JSON to records?
C#CC# / help
4y ago