Table of Contents

Class Extensions

Namespace
Newtonsoft.Json.Linq
Assembly
Newtonsoft.Json.dll

Contains the LINQ to JSON extension methods.

public static class Extensions
Inheritance
Extensions
Inherited Members

Methods

Ancestors<T>(IEnumerable<T>)

Returns a collection of tokens that contains the ancestors of every token in the source collection.

public static IJEnumerable<JToken> Ancestors<T>(this IEnumerable<T> source) where T : JToken

Parameters

source IEnumerable<T>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IJEnumerable<JToken>

An IEnumerable<T> of JToken that contains the ancestors of every node in the source collection.

Type Parameters

T

The type of the objects in source, constrained to JToken.

AsJEnumerable(IEnumerable<JToken>)

Returns the input typed as IJEnumerable<T>.

public static IJEnumerable<JToken> AsJEnumerable(this IEnumerable<JToken> source)

Parameters

source IEnumerable<JToken>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IJEnumerable<JToken>

The input typed as IJEnumerable<T>.

AsJEnumerable<T>(IEnumerable<T>)

Returns the input typed as IJEnumerable<T>.

public static IJEnumerable<T> AsJEnumerable<T>(this IEnumerable<T> source) where T : JToken

Parameters

source IEnumerable<T>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IJEnumerable<T>

The input typed as IJEnumerable<T>.

Type Parameters

T

The source collection type.

Children<T>(IEnumerable<T>)

Returns a collection of child tokens of every array in the source collection.

public static IJEnumerable<JToken> Children<T>(this IEnumerable<T> source) where T : JToken

Parameters

source IEnumerable<T>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IJEnumerable<JToken>

An IEnumerable<T> of JToken that contains the values of every node in the source collection.

Type Parameters

T

The source collection type.

Children<T, U>(IEnumerable<T>)

Returns a collection of converted child tokens of every array in the source collection.

public static IEnumerable<U> Children<T, U>(this IEnumerable<T> source) where T : JToken

Parameters

source IEnumerable<T>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IEnumerable<U>

An IEnumerable<T> that contains the converted values of every node in the source collection.

Type Parameters

T

The source collection type.

U

The type to convert the values to.

Descendants<T>(IEnumerable<T>)

Returns a collection of tokens that contains the descendants of every token in the source collection.

public static IJEnumerable<JToken> Descendants<T>(this IEnumerable<T> source) where T : JContainer

Parameters

source IEnumerable<T>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IJEnumerable<JToken>

An IEnumerable<T> of JToken that contains the descendants of every node in the source collection.

Type Parameters

T

The type of the objects in source, constrained to JContainer.

Properties(IEnumerable<JObject>)

Returns a collection of child properties of every object in the source collection.

public static IJEnumerable<JProperty> Properties(this IEnumerable<JObject> source)

Parameters

source IEnumerable<JObject>

An IEnumerable<T> of JObject that contains the source collection.

Returns

IJEnumerable<JProperty>

An IEnumerable<T> of JProperty that contains the properties of every object in the source collection.

Value<U>(IEnumerable<JToken>)

Converts the value.

public static U Value<U>(this IEnumerable<JToken> value)

Parameters

value IEnumerable<JToken>

A JToken cast as a IEnumerable<T> of JToken.

Returns

U

A converted value.

Type Parameters

U

The type to convert the value to.

Value<T, U>(IEnumerable<T>)

Converts the value.

public static U Value<T, U>(this IEnumerable<T> value) where T : JToken

Parameters

value IEnumerable<T>

A JToken cast as a IEnumerable<T> of JToken.

Returns

U

A converted value.

Type Parameters

T

The source collection type.

U

The type to convert the value to.

Values(IEnumerable<JToken>)

Returns a collection of child values of every object in the source collection.

public static IJEnumerable<JToken> Values(this IEnumerable<JToken> source)

Parameters

source IEnumerable<JToken>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IJEnumerable<JToken>

An IEnumerable<T> of JToken that contains the values of every node in the source collection.

Values(IEnumerable<JToken>, object)

Returns a collection of child values of every object in the source collection with the given key.

public static IJEnumerable<JToken> Values(this IEnumerable<JToken> source, object key)

Parameters

source IEnumerable<JToken>

An IEnumerable<T> of JToken that contains the source collection.

key object

The token key.

Returns

IJEnumerable<JToken>

An IEnumerable<T> of JToken that contains the values of every node in the source collection with the given key.

Values<U>(IEnumerable<JToken>)

Returns a collection of converted child values of every object in the source collection.

public static IEnumerable<U> Values<U>(this IEnumerable<JToken> source)

Parameters

source IEnumerable<JToken>

An IEnumerable<T> of JToken that contains the source collection.

Returns

IEnumerable<U>

An IEnumerable<T> that contains the converted values of every node in the source collection.

Type Parameters

U

The type to convert the values to.

Values<U>(IEnumerable<JToken>, object)

Returns a collection of converted child values of every object in the source collection with the given key.

public static IEnumerable<U> Values<U>(this IEnumerable<JToken> source, object key)

Parameters

source IEnumerable<JToken>

An IEnumerable<T> of JToken that contains the source collection.

key object

The token key.

Returns

IEnumerable<U>

An IEnumerable<T> that contains the converted values of every node in the source collection with the given key.

Type Parameters

U

The type to convert the values to.