JsonArray.Create(JsonElement, Nullable<JsonNodeOptions>) Method

Definition

Initializes a new instance of the JsonArray class that contains items from the specified JsonElement.

C#
public static System.Text.Json.Nodes.JsonArray? Create(System.Text.Json.JsonElement element, System.Text.Json.Nodes.JsonNodeOptions? options = default);

Parameters

element
JsonElement

The JsonElement.

options
Nullable<JsonNodeOptions>

Options to control the behavior.

Returns

The new instance of the JsonArray class that contains items from the specified JsonElement.

Exceptions

The element is not a Array.

Applies to

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