JTokenUtility.TryGetValue method (1 of 2)

Returns the specified array item if possible.

public static JToken? TryGetValue(this JToken? jToken, int itemIndex)
parameter description
jToken The JToken.
itemIndex The index of the array item.

Return Value

This method returns null if the JToken is null, or if it doesn’t contain an array, or if the index is out of bounds.

See Also


JTokenUtility.TryGetValue method (2 of 2)

Returns the specified property value if possible.

public static JToken? TryGetValue(this JToken? jToken, string? propertyName)
parameter description
jToken The JToken.
propertyName The name of the property.

Return Value

This method returns null if the JToken is null, or if it doesn’t contain an object, or if the property name is null, or if the property doesn’t exist.

See Also