❔ 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
Migrate from Newtonsoft.Json to System.Text.Json - .NET
Learn how to migrate from Newtonsoft.Json to System.Text.Json. Includes sample code.
2 Replies
TheBoxyBear
TheBoxyBear2y ago
The functionality being reserved to converters suggests it might be a protected method of JsonConverter<> but it's not
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.