Skip to content

Instantly share code, notes, and snippets.

View idea-lei's full-sized avatar

Lei idea-lei

  • Germany/Deutschland
View GitHub Profile
@chrisoldwood
chrisoldwood / CustomJsonConverter.cs
Last active February 17, 2023 23:16
Example showing infinite loop deserialising polymorphic types with a custom JsonConverter.
namespace JsonTests
{
public class CustomJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(BaseType).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)