Skip to content

vpekarek/InterfaceConverter.SystemTextJson

Repository files navigation

Interface converter for System.Text.Json

Description

Use this converter when you need to serialize and deserialize interface types, or list of object with single interface.

Deserialized entity has the original type as serialized.

Usage

Specify JsonInterfaceConverter on any interface you want to serialize using this converter.

[JsonInterfaceConverter(typeof(InterfaceConverter<IExample>))]
public interface IExample
{
    int Id { get; set; }
    string Name { get; set; }
}

About

Custom C# converter for System.Text.Json that allow serializing and deserializing interfaces.

Resources

Stars

Watchers

Forks

Languages