JsonPathNavigator<TValue> Class
Provides JSONPath navigation services for a custom object model.
public abstract class JsonPathNavigator<TValue>Type parameters
TValue- The node type used by the custom object model.
Constructors
| Name | Description |
|---|---|
| JsonPathNavigator() |
JsonPathNavigator()
protected JsonPathNavigator()No documentation is available.
Properties
| Name | Description |
|---|---|
| HasConstantTimeElementAccess | Gets whether JsonPathNavigator<TValue>.TryGetElement takes constant time. When it does not, the evaluator copies an array with JsonPathNavigator<TValue>.CopyElements before walking it, so that visiting every element stays linear. |
| HasConstantTimePropertyLookup | Gets whether JsonPathNavigator<TValue>.TryGetPropertyValue takes constant time. |
| IsPure | Gets whether navigation is side-effect-free and values remain stable throughout an evaluation. |
HasConstantTimeElementAccess
JsonPathNavigator`1.csGets whether JsonPathNavigator<TValue>.TryGetElement takes constant time. When it does not, the evaluator copies an array with JsonPathNavigator<TValue>.CopyElements before walking it, so that visiting every element stays linear.
public virtual bool HasConstantTimeElementAccess { get; }Property value
HasConstantTimePropertyLookup
JsonPathNavigator`1.csGets whether JsonPathNavigator<TValue>.TryGetPropertyValue takes constant time.
public virtual bool HasConstantTimePropertyLookup { get; }Property value
Remarks
When this is false, the evaluator enumerates the right object once to build an ordinal lookup table when comparing objects for equality. If a name occurs more than once, the last value is used and earlier values are ignored, matching the semantics of JsonPathNavigator<TValue>.TryGetPropertyValue.
IsPure
JsonPathNavigator`1.csMethods
| Name | Description |
|---|---|
| CopyElements(TValue?, TValue?[]) | Copies the elements of an array, in index order, to the start of destination. |
| GetArrayLength(TValue?) | Gets an array length. |
| GetKind(TValue?) | Gets the JSON node kind represented by value. |
| GetProperties(TValue?) | Gets object properties in enumeration order. |
| TryGetBoolean(TValue?, bool) | Gets a boolean scalar value. |
| TryGetElement(TValue?, int, TValue?) | Gets an array element by zero-based index. |
| TryGetNumber(TValue?, double) | Gets a number scalar value. |
| TryGetNumberText(TValue?, string?) | Gets the exact text of a number scalar value, such as 9007199254740993 or 0.1. |
| TryGetPropertyValue(TValue?, string, TValue?) | Gets an object property value. |
| TryGetString(TValue?, string?) | Gets a string scalar value. |
CopyElements(TValue?, TValue?[])
JsonPathNavigator`1.csCopies the elements of an array, in index order, to the start of destination.
public virtual void CopyElements(TValue? value, TValue?[] destination)Parameters
valueTValue?- The array value.
destinationTValue?[]- A buffer holding at least
JsonPathNavigator<TValue>.GetArrayLengthitems.
Remarks
Implementations must write the first JsonPathNavigator<TValue>.GetArrayLength items in index order. If an element cannot be retrieved, write default at its index.
GetArrayLength(TValue?)
GetKind(TValue?)
Gets the JSON node kind represented by value.
public abstract JsonPathNodeKind GetKind(TValue? value)Parameters
valueTValue?- The value to inspect. Navigators may use
nullor a model-specific value to represent JSONnull.
Returns
JsonPathNodeKind The JSON node kind represented by value.
GetProperties(TValue?)
Gets object properties in enumeration order.
public abstract IEnumerable<JsonPathProperty<TValue>> GetProperties(TValue? value)Parameters
valueTValue?- The object value.
Returns
IEnumerable<JsonPathProperty<TValue>> The object properties in enumeration order.
TryGetBoolean(TValue?, bool)
TryGetElement(TValue?, int, TValue?)
Gets an array element by zero-based index.
TryGetNumber(TValue?, double)
TryGetNumberText(TValue?, string?)
JsonPathNavigator`1.csGets the exact text of a number scalar value, such as 9007199254740993 or 0.1.
Parameters
valueTValue?- The scalar value.
resultstring?- When this method returns, contains the number as JSON writes it.
Returns
bool true when value represents a number whose text is known; otherwise, false.
Remarks
Filters compare the Double values of JsonPathNavigator<TValue>.TryGetNumber first. When two numbers round to the same Double, they compare their texts, so that distinct numbers such as 9007199254740992 and 9007199254740993 do not compare as equal. Return false when the text is not known: the numbers then compare as Double values. The default implementation returns false. The text has an optional minus sign, digits, an optional fraction and an optional exponent, like a JSON number; leading zeros and an uppercase E are accepted, so the result of ToString(CultureInfo.InvariantCulture) on a Int64, a Decimal or a BigInteger can be returned as is.
TryGetPropertyValue(TValue?, string, TValue?)
Gets an object property value.