Redigera

Dela via


JsonSerializerOptions.PropertyNamingPolicy Property

Definition

Gets or sets a value that specifies the policy used to convert a property's name on an object to another format, such as camel-casing, or null to leave property names unchanged.

public:
 property System::Text::Json::JsonNamingPolicy ^ PropertyNamingPolicy { System::Text::Json::JsonNamingPolicy ^ get(); void set(System::Text::Json::JsonNamingPolicy ^ value); };
public System.Text.Json.JsonNamingPolicy? PropertyNamingPolicy { get; set; }
public System.Text.Json.JsonNamingPolicy PropertyNamingPolicy { get; set; }
member this.PropertyNamingPolicy : System.Text.Json.JsonNamingPolicy with get, set
Public Property PropertyNamingPolicy As JsonNamingPolicy

Property Value

A property naming policy, or null to leave property names unchanged.

Remarks

The resulting property name is expected to match the JSON payload during deserialization, and will be used when writing the property name during serialization.

The policy is not used for properties that have a JsonPropertyNameAttribute applied.

For more information, see How to customize property names and values with System.Text.Json.

Applies to