JsonPropertyNameAttribute
Specifies the property name that is present in the JSON when serializing and deserializing. This overrides any naming policy specified by JsonNamingPolicy.
using System.Runtime.CompilerServices;
namespace System.Text.Json.Serialization
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class JsonPropertyNameAttribute : JsonAttribute
{
public string Name { get; }
public JsonPropertyNameAttribute(string name)
{
Name = name;
}
}
}