Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

JsonSerializerOptions.PreferredObjectCreationHandling Property

Definition

Namespace:
System.Text.Json
Assembly:
System.Text.Json.dll
Package:
System.Text.Json v11.0.0-preview.5.26302.115
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

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 preferred object creation handling for properties when deserializing JSON.

public:
 property System::Text::Json::Serialization::JsonObjectCreationHandling PreferredObjectCreationHandling { System::Text::Json::Serialization::JsonObjectCreationHandling get(); void set(System::Text::Json::Serialization::JsonObjectCreationHandling value); };
public System.Text.Json.Serialization.JsonObjectCreationHandling PreferredObjectCreationHandling { get; set; }
member this.PreferredObjectCreationHandling : System.Text.Json.Serialization.JsonObjectCreationHandling with get, set
Public Property PreferredObjectCreationHandling As JsonObjectCreationHandling

Property Value

When set to Populate, all properties that are capable of reusing the existing instance will be populated.

Remarks

Only property type is taken into consideration. For example, if a property is of type IEnumerable<T> but it is assigned List<T>, it won't be populated because IEnumerable<T> is not capable of populating. Additionally, value types require a setter to be populated.

Applies to


Feedback

Was this page helpful?