JsonSerializerOptions.DictionaryKeyPolicy Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets or sets the policy used to convert a IDictionary key's name to another format, such as camel-casing.

C#
public System.Text.Json.JsonNamingPolicy? DictionaryKeyPolicy { get; set; }
C#
public System.Text.Json.JsonNamingPolicy DictionaryKeyPolicy { get; set; }

Property Value

The policy used to convert a IDictionary key's name to another format.

Remarks

The naming policy is not used when deserializing.

For more information, see Use a naming policy for dictionary keys.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)