PROPERTY

JsonSerializerOptions.AllowDuplicateProperties

In .NET 10, set false to reject duplicate property names during deserialization. This is separate from rejecting unknown properties, requiring members or enforcing domain values.

Formal Syntax & Structure

csharp syntaxcsharp
new JsonSerializerOptions { AllowDuplicateProperties = false }

Working Example

Example Snippetcsharp
using System;using System.IO;using System.Collections.Generic;using System.Text.Json;var options = new JsonSerializerOptions { AllowDuplicateProperties = false }; Console.WriteLine(options.AllowDuplicateProperties); // False
C# & .NET Reference