แก้ไข

แชร์ผ่าน


JsonSerializerOptions.ReadCommentHandling Property

Definition

Gets or sets a value that defines how comments are handled during deserialization.

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

Property Value

A value that indicates whether comments are allowed, disallowed, or skipped.

Exceptions

This property was set after serialization or deserialization has occurred.

The comment handling enum is set to a value that is not supported (or not within the JsonCommentHandling enum range).

Remarks

By default, a JsonException is thrown during deserialization if a comment is encountered.

For more information, see How to allow some kinds of invalid JSON with System.Text.Json.

Applies to