<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />

JToken

Represents an abstract JSON token.

Gets a comparer that can compare two tokens for value equality.

public virtual JToken First { get; }

Get the first child token of this token.

public abstract bool HasValues { get; }

Gets a value indicating whether this token has child tokens.

public virtual JToken this[object key] { get; set; }

Gets the JToken with the specified key.

public virtual JToken Last { get; }

Get the last child token of this token.

public JToken Next { get; }

Gets the next sibling token of this node.

public JContainer Parent { get; }

Gets or sets the parent.

public string Path { get; }

Gets the path of the JSON token.

public JToken Previous { get; }

Gets the previous sibling token of this node.

public JToken Root { get; }

Gets the root JToken of this JToken.

public abstract JTokenType Type { get; }

Gets the node type for this JToken.

public static bool DeepEquals(JToken t1, JToken t2)

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

public static JToken FromObject(object o)

Creates a JToken from an object.

public static JToken FromObject(object o, JsonSerializer jsonSerializer)

Creates a JToken from an object using the specified JsonSerializer.

public static JToken Load(JsonReader reader, JsonLoadSettings settings)

Creates a JToken from a JsonReader.

public static JToken Load(JsonReader reader)

Creates a JToken from a JsonReader.

public static Task<JToken> LoadAsync(JsonReader reader, CancellationToken cancellationToken = default)

Asynchronously creates a JToken from a JsonReader.

public static Task<JToken> LoadAsync(JsonReader reader, JsonLoadSettings settings, CancellationToken cancellationToken = default)

Asynchronously creates a JToken from a JsonReader.

public static bool op_Explicit(JToken value)

Performs an explicit conversion from JToken to Boolean.

public static DateTimeOffset op_Explicit(JToken value)

Performs an explicit conversion from JToken to DateTimeOffset.

public static bool? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Boolean.

public static long op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Int64.

public static DateTime? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of DateTime.

public static DateTimeOffset? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of DateTimeOffset.

public static decimal? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Decimal.

public static double? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Double.

public static char? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Char.

public static int op_Explicit(JToken value)

Performs an explicit conversion from JToken to Int32.

public static short op_Explicit(JToken value)

Performs an explicit conversion from JToken to Int16.

public static ushort op_Explicit(JToken value)

Performs an explicit conversion from JToken to UInt16.

public static char op_Explicit(JToken value)

Performs an explicit conversion from JToken to Char.

public static byte op_Explicit(JToken value)

Performs an explicit conversion from JToken to Byte.

public static sbyte op_Explicit(JToken value)

Performs an explicit conversion from JToken to SByte.

public static int? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Int32 .

public static short? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Int16.

public static ushort? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of UInt16.

public static byte? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Byte.

public static sbyte? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of SByte.

public static DateTime op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of DateTime.

public static long? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Int64.

public static float? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Single.

public static decimal op_Explicit(JToken value)

Performs an explicit conversion from JToken to Decimal.

public static uint? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of UInt32.

public static ulong? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of UInt64.

public static double op_Explicit(JToken value)

Performs an explicit conversion from JToken to Double.

public static float op_Explicit(JToken value)

Performs an explicit conversion from JToken to Single.

public static string op_Explicit(JToken value)

Performs an explicit conversion from JToken to String.

public static uint op_Explicit(JToken value)

Performs an explicit conversion from JToken to UInt32.

public static ulong op_Explicit(JToken value)

Performs an explicit conversion from JToken to UInt64.

public static byte[] op_Explicit(JToken value)

Performs an explicit conversion from JToken to Byte[].

public static Guid op_Explicit(JToken value)

Performs an explicit conversion from JToken to Guid.

public static Guid? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of Guid .

public static TimeSpan op_Explicit(JToken value)

Performs an explicit conversion from JToken to TimeSpan.

public static TimeSpan? op_Explicit(JToken value)

Performs an explicit conversion from JToken to Nullable<T> of TimeSpan.

public static Uri op_Explicit(JToken value)

Performs an explicit conversion from JToken to Uri.

public static JToken op_Implicit(bool value)

Performs an implicit conversion from Boolean to JToken.

public static JToken op_Implicit(DateTimeOffset value)

Performs an implicit conversion from DateTimeOffset to JToken.

public static JToken op_Implicit(byte value)

Performs an implicit conversion from Byte to JToken.

public static JToken op_Implicit(byte? value)

Performs an implicit conversion from Nullable<T> of Byte to JToken.

public static JToken op_Implicit(sbyte value)

Performs an implicit conversion from SByte to JToken.

public static JToken op_Implicit(sbyte? value)

Performs an implicit conversion from Nullable<T> of SByte to JToken.

public static JToken op_Implicit(bool? value)

Performs an implicit conversion from Nullable<T> of Boolean to JToken.

public static JToken op_Implicit(long value)

Performs an implicit conversion from Nullable<T> of Int64 to JToken.

public static JToken op_Implicit(DateTime? value)

Performs an implicit conversion from Nullable<T> of DateTime to JToken.

public static JToken op_Implicit(DateTimeOffset? value)

Performs an implicit conversion from Nullable<T> of DateTimeOffset to JToken.

public static JToken op_Implicit(decimal? value)

Performs an implicit conversion from Nullable<T> of Decimal to JToken.

public static JToken op_Implicit(double? value)

Performs an implicit conversion from Nullable<T> of Double to JToken.

public static JToken op_Implicit(short value)

Performs an implicit conversion from Int16 to JToken.

public static JToken op_Implicit(ushort value)

Performs an implicit conversion from UInt16 to JToken.

public static JToken op_Implicit(int value)

Performs an implicit conversion from Int32 to JToken.

public static JToken op_Implicit(int? value)

Performs an implicit conversion from Nullable<T> of Int32 to JToken.

public static JToken op_Implicit(DateTime value)

Performs an implicit conversion from DateTime to JToken.

public static JToken op_Implicit(long? value)

Performs an implicit conversion from Nullable<T> of Int64 to JToken.

public static JToken op_Implicit(float? value)

Performs an implicit conversion from Nullable<T> of Single to JToken.

public static JToken op_Implicit(decimal value)

Performs an implicit conversion from Decimal to JToken.

public static JToken op_Implicit(short? value)

Performs an implicit conversion from Nullable<T> of Int16 to JToken.

public static JToken op_Implicit(ushort? value)

Performs an implicit conversion from Nullable<T> of UInt16 to JToken.

public static JToken op_Implicit(uint? value)

Performs an implicit conversion from Nullable<T> of UInt32 to JToken.

public static JToken op_Implicit(ulong? value)

Performs an implicit conversion from Nullable<T> of UInt64 to JToken.

public static JToken op_Implicit(double value)

Performs an implicit conversion from Double to JToken.

public static JToken op_Implicit(float value)

Performs an implicit conversion from Single to JToken.

public static JToken op_Implicit(string value)

Performs an implicit conversion from String to JToken.

public static JToken op_Implicit(uint value)

Performs an implicit conversion from UInt32 to JToken.

public static JToken op_Implicit(ulong value)

Performs an implicit conversion from UInt64 to JToken.

public static JToken op_Implicit(byte[] value)

Performs an implicit conversion from Byte[] to JToken.

public static JToken op_Implicit(Uri value)

Performs an implicit conversion from Uri to JToken.

public static JToken op_Implicit(TimeSpan value)

Performs an implicit conversion from TimeSpan to JToken.

public static JToken op_Implicit(TimeSpan? value)

Performs an implicit conversion from Nullable<T> of TimeSpan to JToken.

public static JToken op_Implicit(Guid value)

Performs an implicit conversion from Guid to JToken.

public static JToken op_Implicit(Guid? value)

Performs an implicit conversion from Nullable<T> of Guid to JToken.

public static JToken Parse(string json)

Load a JToken from a string that contains JSON.

public static JToken Parse(string json, JsonLoadSettings settings)

Load a JToken from a string that contains JSON.

public static JToken ReadFrom(JsonReader reader)

Creates a JToken from a JsonReader.

public static JToken ReadFrom(JsonReader reader, JsonLoadSettings settings)

Creates a JToken from a JsonReader.

public static Task<JToken> ReadFromAsync(JsonReader reader, CancellationToken cancellationToken = default)

Asynchronously creates a JToken from a JsonReader.

public static Task<JToken> ReadFromAsync(JsonReader reader, JsonLoadSettings settings, CancellationToken cancellationToken = default)

Asynchronously creates a JToken from a JsonReader.

public void AddAfterSelf(object content)

Adds the specified content immediately after this token.

public void AddAnnotation(object annotation)

Adds an object to the annotation list of this JToken.

public void AddBeforeSelf(object content)

Adds the specified content immediately before this token.

Returns a collection of the sibling tokens after this token, in document order.

Returns a collection of the ancestor tokens of this token.

Returns a collection of tokens that contain this token, and the ancestors of this token.

public T Annotation<T>()

Get the first annotation object of the specified type from this JToken.

public object Annotation(Type type)

Gets the first annotation object of the specified type from this JToken.

public IEnumerable<T> Annotations<T>()

Gets a collection of annotations of the specified type for this JToken.

public IEnumerable<object> Annotations(Type type)

Gets a collection of annotations of the specified type for this JToken.

Returns a collection of the sibling tokens before this token, in document order.

public virtual JEnumerable<JToken> Children()

Returns a collection of the child tokens of this token, in document order.

public JEnumerable<T> Children<T>() where T : JToken

Returns a collection of the child tokens of this token, in document order, filtered by the specified type.

Creates a JsonReader for this token.

public JToken DeepClone()

Creates a new instance of the JToken. All child tokens are recursively cloned.

protected virtual DynamicMetaObject GetMetaObject(Expression parameter)

Returns the DynamicMetaObject responsible for binding operations performed on this object.

public void Remove()

Removes this token from its parent.

public void RemoveAnnotations<T>()

Removes the annotations of the specified type from this JToken.

public void RemoveAnnotations(Type type)

Removes the annotations of the specified type from this JToken.

public void Replace(JToken value)

Replaces this token with the specified token.

public JToken SelectToken(string path)

Selects a JToken using a JPath expression. Selects the token that matches the object path.

public JToken SelectToken(string path, bool errorWhenNoMatch)

Selects a JToken using a JPath expression. Selects the token that matches the object path.

public IEnumerable<JToken> SelectTokens(string path)

Selects a collection of elements using a JPath expression.

public IEnumerable<JToken> SelectTokens(string path, bool errorWhenNoMatch)

Selects a collection of elements using a JPath expression.

public T ToObject<T>()

Creates an instance of the specified .NET type from the JToken.

public object ToObject(Type objectType)

Creates an instance of the specified .NET type from the JToken.

public T ToObject<T>(JsonSerializer jsonSerializer)

Creates an instance of the specified .NET type from the JToken using the specified JsonSerializer.

public object ToObject(Type objectType, JsonSerializer jsonSerializer)

Creates an instance of the specified .NET type from the JToken using the specified JsonSerializer.

public string ToString(Formatting formatting, JsonConverter[] converters)

Returns the JSON for this token using the given formatting and converters.

public virtual T Value<T>(object key)

Gets the JToken with the specified key converted to the specified type.

public virtual IEnumerable<T> Values<T>()

Returns a collection of the child values of this token, in document order.

public abstract void WriteTo(JsonWriter writer, JsonConverter[] converters)

Writes this token to a JsonWriter.

public virtual Task WriteToAsync(JsonWriter writer, CancellationToken cancellationToken, JsonConverter[] converters)

Writes this token to a JsonWriter asynchronously.

public Task WriteToAsync(JsonWriter writer, JsonConverter[] converters)

Writes this token to a JsonWriter asynchronously.