Property AllowTrailingCommas
AllowTrailingCommas
Gets or sets a value indicating whether trailing commas are
allowed in the JSON input.
Declaration
public bool AllowTrailingCommas { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
true to allow trailing commas, false to disallow
trailing commas. The default is false .
|
Remarks
Trailing commas are extra commas at the end of a list of JSON values in an object or array. If allowed, they are ignored. If not allowed and they are encountered in JSON input, FromJsonString(String, JsonInputOptions) will throw JsonParseException.
This option does not apply to DeserializeFromJson(ref Utf8JsonReader, JsonInputOptions) (instead use JsonReaderOptions when creating Utf8JsonReader).
Examples
JSON with trailing commas.{
"key1": "string value",
"key2": [ 1, 2, 3, 4, 5 ],
"key2": true,
}