Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Text.​Json.​Nodes.​JsonValue

Assembly: System.Text.Json

Inheritance: object → JsonNode → JsonValue

Represents a mutable JSON value.

Properties

public JsonNode
Item
public JsonNode
Item
public JsonNodeOptions?
Options
Gets the options to control the behavior.
public JsonNode
Parent
Gets the parent <see cref="T:System.Text.Json.Nodes.JsonNode" /> . If there is no parent, <see langword="null" /> is returned. A parent can either be a <see cref="T:System.Text.Json.Nodes.JsonObject" /> or a <see cref="T:System.Text.Json.Nodes.JsonArray" /> .
public JsonNode
Root
Gets the root <see cref="T:System.Text.Json.Nodes.JsonNode" /> .

Methods

public static JsonValue
Create​(bool value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(byte value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(char value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(DateTime value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(DateTimeOffset value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(decimal value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(double value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(Guid value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(short value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(int value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(long value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(bool? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(byte? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(char? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(DateTimeOffset? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(DateTime? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(decimal? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(double? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(Guid? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(short? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(int? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(long? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(sbyte? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(Single? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(JsonElement? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(ushort? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(uint? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(ulong? value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(sbyte value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(Single value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(string value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(JsonElement value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(ushort value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(uint value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(ulong value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The underlying value of the new <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
options Options to control the behavior.
public static JsonValue
Create​(T value, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The value to create.
options Options to control the behavior.
public static JsonValue
Create​(T value, Serialization.​Metadata.​JsonTypeInfo<​T> jsonTypeInfo, JsonNodeOptions? options = null)
Initializes a new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
Returns The new instance of the <see cref="T:System.Text.Json.Nodes.JsonValue" /> class that contains the specified value.
value The value to create.
jsonTypeInfo The <see cref="T:System.Text.Json.Serialization.Metadata.JsonTypeInfo" /> that will be used to serialize the value.
options Options to control the behavior.
public bool
TryGetValue​(T& value)
public JsonArray
AsArray​()
Inherited from JsonNode
Casts to the derived <see cref="T:System.Text.Json.Nodes.JsonArray" /> type.
Returns A <see cref="T:System.Text.Json.Nodes.JsonArray" /> .
public JsonObject
AsObject​()
Inherited from JsonNode
Casts to the derived <see cref="T:System.Text.Json.Nodes.JsonObject" /> type.
Returns A <see cref="T:System.Text.Json.Nodes.JsonObject" /> .
public JsonValue
AsValue​()
Inherited from JsonNode
Casts to the derived <see cref="T:System.Text.Json.Nodes.JsonValue" /> type.
Returns A <see cref="T:System.Text.Json.Nodes.JsonValue" /> .
public JsonNode
DeepClone​()
Inherited from JsonNode
Creates a new instance of the <see cref="T:System.Text.Json.Nodes.JsonNode" /> class. All child nodes are recursively cloned.
Returns A new cloned instance of the current node.
public int
GetElementIndex​()
Inherited from JsonNode
Returns the index of the current node from the parent <see cref="T:System.Text.Json.Nodes.JsonArray" /> .
Returns The index of the current node.
public string
GetPath​()
Inherited from JsonNode
Gets the JSON path.
Returns The JSON Path value.
public string
GetPropertyName​()
Inherited from JsonNode
Returns the property name of the current node from the parent object.
Returns The property name of the current node.
public JsonValueKind
GetValueKind​()
Inherited from JsonNode
Returns the <see cref="T:System.Text.Json.JsonValueKind" /> of the current instance.
Returns The json value kind of the current instance.
public T
GetValue​()
Inherited from JsonNode
Gets the value for the current <see cref="T:System.Text.Json.Nodes.JsonValue" /> .
Returns A value converted from the <see cref="T:System.Text.Json.Nodes.JsonValue" /> instance.
public void
ReplaceWith​(T value)
Inherited from JsonNode
Replaces this node with a new value.
value The value that replaces this node.
public string
ToJsonString​(JsonSerializerOptions? options = null)
Inherited from JsonNode
Converts the current instance to a string in JSON format.
Returns The JSON representation of the current instance.
options Options to control the serialization behavior.
public string
ToString​()
Inherited from JsonNode
Gets a string representation for the current value appropriate to the node type.
Returns A string representation for the current value appropriate to the node type.
public void
WriteTo​(Utf8JsonWriter writer, JsonSerializerOptions? options = null)
Inherited from JsonNode
Writes the <see cref="T:System.Text.Json.Nodes.JsonNode" /> into the provided <see cref="T:System.Text.Json.Utf8JsonWriter" /> as JSON.
writer The <see cref="T:System.Text.Json.Utf8JsonWriter" /> .
options Options to control the serialization behavior.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object