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

JsonNode

public abstract class JsonNode
The base class that represents a single node within a mutable JSON document.
public JsonNode this[int index] { get; set; }

Gets or sets the element at the specified index.

public JsonNode this[string propertyName] { get; set; }

Gets or sets the element with the specified property name. If the property is not found, null is returned.

public JsonNodeOptions? Options { get; }

Gets the options to control the behavior.

public JsonNode Parent { get; }

Gets the parent JsonNode. If there is no parent, null is returned. A parent can either be a JsonObject or a JsonArray.

public JsonNode Root { get; }

Gets the root JsonNode.

public static bool DeepEquals(JsonNode node1, JsonNode node2)

Compares the values of two nodes, including the values of all descendant nodes.

public static bool op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Boolean.

public static bool? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Boolean.

public static byte op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Byte.

public static byte? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Byte.

public static char op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Char.

public static char? op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Char.

public static DateTime op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a DateTime.

public static DateTime? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable DateTime.

public static DateTimeOffset op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a DateTimeOffset.

public static DateTimeOffset? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable DateTimeOffset.

public static decimal op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Decimal.

public static decimal? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Decimal.

public static double op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Double.

public static double? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Double.

public static Guid op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Guid.

public static Guid? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Guid.

public static short op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to an Int16.

public static short? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Int16.

public static int op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to an Int32.

public static int? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Int32.

public static long op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to an Int64.

public static long? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Int64.

public static sbyte op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to an SByte.

public static sbyte? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable SByte.

public static float op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a Single.

public static float? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable Single.

public static string op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable String.

public static ushort op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a UInt16.

public static ushort? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable UInt16.

public static uint op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a UInt32.

public static uint? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable UInt32.

public static ulong op_Explicit(JsonNode value)

Defines an explicit conversion of a given JsonNode to a UInt64.

public static ulong? op_Explicit(JsonNode value)

Defines an explicit conversion of a specified nullable JsonNode to a nullable UInt64.

public static JsonNode op_Implicit(bool value)

Defines an implicit conversion of a given Boolean to a JsonNode.

public static JsonNode op_Implicit(bool? value)

Defines an implicit conversion of a specified nullable Boolean to a nullable JsonNode.

public static JsonNode op_Implicit(byte value)

Defines an implicit conversion of a given Byte to a JsonNode.

public static JsonNode op_Implicit(byte? value)

Defines an implicit conversion of a specified nullable Byte to a JsonNode.

public static JsonNode op_Implicit(char value)

Defines an implicit conversion of a given Char to a JsonNode.

public static JsonNode op_Implicit(char? value)

Defines an implicit conversion of a specified nullable Char to a JsonNode.

public static JsonNode op_Implicit(DateTime value)

Defines an implicit conversion of a given DateTime to a JsonNode.

public static JsonNode op_Implicit(DateTime? value)

Defines an implicit conversion of a specified nullable DateTime to a JsonNode.

public static JsonNode op_Implicit(DateTimeOffset value)

Defines an implicit conversion of a given DateTimeOffset to a JsonNode.

public static JsonNode op_Implicit(DateTimeOffset? value)

Defines an implicit conversion of a specified nullable DateTimeOffset to a JsonNode.

public static JsonNode op_Implicit(decimal value)

Defines an implicit conversion of a given Decimal to a JsonNode.

public static JsonNode op_Implicit(decimal? value)

Defines an implicit conversion of a specified nullable Decimal to a JsonNode.

public static JsonNode op_Implicit(double value)

Defines an implicit conversion of a given Double to a JsonNode.

public static JsonNode op_Implicit(double? value)

Defines an implicit conversion of a specified nullable Double to a JsonNode.

public static JsonNode op_Implicit(Guid value)

Defines an implicit conversion of a given Guid to a JsonNode.

public static JsonNode op_Implicit(Guid? value)

Defines an implicit conversion of a specified nullable Guid to a JsonNode.

public static JsonNode op_Implicit(short value)

Defines an implicit conversion of a given Int16 to a JsonNode.

public static JsonNode op_Implicit(short? value)

Defines an implicit conversion of a specified nullable Int16 to a JsonNode.

public static JsonNode op_Implicit(int value)

Defines an implicit conversion of a given Int32 to a JsonNode.

public static JsonNode op_Implicit(int? value)

Defines an implicit conversion of a specified nullable Int32 to a JsonNode.

public static JsonNode op_Implicit(long value)

Defines an implicit conversion of a given Int64 to a JsonNode.

public static JsonNode op_Implicit(long? value)

Defines an implicit conversion of a specified nullable Int64 to a JsonNode.

public static JsonNode op_Implicit(sbyte value)

Defines an implicit conversion of a specified nullable SByte to a JsonNode.

public static JsonNode op_Implicit(sbyte? value)

Defines an implicit conversion of a specified nullable SByte to a JsonNode.

public static JsonNode op_Implicit(float value)

Defines an implicit conversion of a specified nullable Single to a JsonNode.

public static JsonNode op_Implicit(float? value)

Defines an implicit conversion of a specified nullable Single to a JsonNode.

public static JsonNode op_Implicit(string value)

Defines an implicit conversion of a specified nullable String to a JsonNode.

public static JsonNode op_Implicit(ushort value)

Defines an implicit conversion of a specified nullable UInt16 to a JsonNode.

public static JsonNode op_Implicit(ushort? value)

Defines an implicit conversion of a specified nullable UInt16 to a JsonNode.

public static JsonNode op_Implicit(uint value)

Defines an implicit conversion of a specified nullable UInt32 to a JsonNode.

public static JsonNode op_Implicit(uint? value)

Defines an implicit conversion of a specified nullable UInt32 to a JsonNode.

public static JsonNode op_Implicit(ulong value)

Defines an implicit conversion of a specified nullable UInt64 to a JsonNode.

public static JsonNode op_Implicit(ulong? value)

Defines an implicit conversion of a specified nullable UInt64 to a JsonNode.

public static JsonNode Parse(ref Utf8JsonReader reader, JsonNodeOptions? nodeOptions = default)

Parses one JSON value (including objects or arrays) from the provided reader.

public static JsonNode Parse(string json, JsonNodeOptions? nodeOptions = default, JsonDocumentOptions documentOptions = default)

Parses text representing a single JSON value.

public static JsonNode Parse(ReadOnlySpan<byte> utf8Json, JsonNodeOptions? nodeOptions = default, JsonDocumentOptions documentOptions = default)

Parses text representing a single JSON value.

public static JsonNode Parse(Stream utf8Json, JsonNodeOptions? nodeOptions = default, JsonDocumentOptions documentOptions = default)

Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonNode. The Stream will be read to completion.

public static Task<JsonNode> ParseAsync(Stream utf8Json, JsonNodeOptions? nodeOptions = default, JsonDocumentOptions documentOptions = default, CancellationToken cancellationToken = default)

Parses a Stream as UTF-8 encoded data representing a single JSON value into a JsonNode. The stream will be read to completion.

public JsonArray AsArray()

Casts to the derived JsonArray type.

Casts to the derived JsonObject type.

public JsonValue AsValue()

Casts to the derived JsonValue type.

Creates a new instance of the JsonNode class. All child nodes are recursively cloned.

public int GetElementIndex()

Returns the index of the current node from the parent JsonArray.

public string GetPath()

Gets the JSON path.

public string GetPropertyName()

Returns the property name of the current node from the parent object.

public virtual T GetValue<T>()

Gets the value for the current JsonValue.

Returns the JsonValueKind of the current instance.

public void ReplaceWith<T>(T value)

Replaces this node with a new value.

public string ToJsonString(JsonSerializerOptions options = null)

Converts the current instance to string in JSON format.

public abstract void WriteTo(Utf8JsonWriter writer, JsonSerializerOptions options = null)

Writes the JsonNode into the provided Utf8JsonWriter as JSON.