<PackageReference Include="System.Text.Json" Version="6.0.11" />

JsonObject

Represents a mutable JSON object.
public int Count { get; }

Gets the number of elements contained in JsonObject.

public JsonObject(JsonNodeOptions? options = default)

Initializes a new instance of the JsonObject class that is empty.

public JsonObject(IEnumerable<KeyValuePair<string, JsonNode>> properties, JsonNodeOptions? options = default)

Initializes a new instance of the JsonObject class that contains the specified properties.

public static JsonObject Create(JsonElement element, JsonNodeOptions? options = default)

Initializes a new instance of the JsonObject class that contains properties from the specified JsonElement.

public void Add(string propertyName, JsonNode value)

Adds an element with the provided property name and value to the JsonObject.

public void Add(KeyValuePair<string, JsonNode> property)

Adds the specified property to the JsonObject.

public void Clear()

Removes all elements from the JsonObject.

public bool ContainsKey(string propertyName)

Determines whether the JsonObject contains an element with the specified property name.

Returns an enumerator that iterates through the JsonObject.

public bool Remove(string propertyName)

Removes the element with the specified property name from the JsonObject.

public bool TryGetPropertyValue(string propertyName, out JsonNode jsonNode)

Returns the value of a property with the specified name.