JsonNode.GetValue<T> Method


Gets the value for the current JsonValue.

generic <typename T>
 virtual T GetValue();
public virtual T GetValue<T> ();
abstract member GetValue : unit -> 'T
override this.GetValue : unit -> 'T
Public Overridable Function GetValue(Of T) () As T

Type Parameters


The type of the value to obtain from the JsonValue.



A value converted from the JsonValue instance.


The current JsonNode cannot be represented as a {TValue}.

The current JsonNode is not a JsonValue or is not compatible with {TValue}.


{T} can be the type or base type of the underlying value. If the underlying value is a JsonElement then {T} can also be the type of any primitive value supported by current JsonElement.

Specifying the Object type for {T} will always succeed and return the underlying value as Object.

The underlying value of a JsonValue after deserialization is an instance of JsonElement,otherwise it's the value specified when the JsonValue was created.

Applies to