C#C
C#4y ago
2 replies
TheBoxyBear

❔ Populating existing instances

I'm migrating from Newtonsoft to System.Text.Json but my model uses a property in the json to determine the runtime type of the object from a common base type. This article mentions that new instances are always created but that custom converters can populate an existing instance but I can't find how to do that anywhere. https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft?pivots=dotnet-7-0#populate-existing-objects
Learn how to migrate from Newtonsoft.Json to System.Text.Json. Includes sample code.
Migrate from Newtonsoft.Json to System.Text.Json - .NET
Was this page helpful?