JsonConverterAttribute
When placed on a property or type, specifies the converter type to use.
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace System.Text.Json.Serialization
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface, AllowMultiple = false)]
public class JsonConverterAttribute : JsonAttribute
{
[System.Runtime.CompilerServices.Nullable(2)]
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public Type ConverterType {
[System.Runtime.CompilerServices.NullableContext(2)]
get;
}
public JsonConverterAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type converterType)
{
ConverterType = converterType;
}
protected JsonConverterAttribute()
{
}
[return: System.Runtime.CompilerServices.Nullable(2)]
public virtual JsonConverter CreateConverter(Type typeToConvert)
{
return null;
}
}
}