<PackageReference Include="System.Text.Json" Version="6.0.9" />

JsonConverterFactory

public abstract class JsonConverterFactory : JsonConverter
Supports converting several types by using a factory pattern.
using System.Runtime.CompilerServices; using System.Text.Json.Serialization.Metadata; namespace System.Text.Json.Serialization { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public abstract class JsonConverterFactory : JsonConverter { internal sealed override ConverterStrategy ConverterStrategy => ConverterStrategy.None; [System.Runtime.CompilerServices.Nullable(2)] internal sealed override Type KeyType { get { return null; } } [System.Runtime.CompilerServices.Nullable(2)] internal sealed override Type ElementType { get { return null; } } internal sealed override Type TypeToConvert => null; [return: System.Runtime.CompilerServices.Nullable(2)] public abstract JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options); internal override JsonPropertyInfo CreateJsonPropertyInfo() { throw new InvalidOperationException(); } internal override JsonParameterInfo CreateJsonParameterInfo() { throw new InvalidOperationException(); } internal JsonConverter GetConverterInternal(Type typeToConvert, JsonSerializerOptions options) { JsonConverter jsonConverter = CreateConverter(typeToConvert, options); if (jsonConverter == null) ThrowHelper.ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(GetType()); if (jsonConverter is JsonConverterFactory) ThrowHelper.ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactorty(GetType()); return jsonConverter; } internal sealed override object ReadCoreAsObject(ref Utf8JsonReader reader, JsonSerializerOptions options, ref ReadStack state) { throw new InvalidOperationException(); } internal sealed override bool TryReadAsObject(ref Utf8JsonReader reader, JsonSerializerOptions options, ref ReadStack state, out object value) { throw new InvalidOperationException(); } internal sealed override bool TryWriteAsObject(Utf8JsonWriter writer, object value, JsonSerializerOptions options, ref WriteStack state) { throw new InvalidOperationException(); } internal sealed override bool WriteCoreAsObject(Utf8JsonWriter writer, object value, JsonSerializerOptions options, ref WriteStack state) { throw new InvalidOperationException(); } internal sealed override void WriteAsPropertyNameCoreAsObject(Utf8JsonWriter writer, object value, JsonSerializerOptions options, bool isWritingExtensionDataProperty) { throw new InvalidOperationException(); } } }