JsonPathExtensions Class
Provides JSONPath evaluation helpers for JSON values.
public static class JsonPathExtensionsMethods
| Name | Description |
|---|---|
| Evaluate(JsonDocument?, JsonPath) | Evaluates a JSONPath expression against this JSON document. |
| Evaluate(JsonDocument?, JsonPath, JsonPathEvaluationMode) | Evaluates a JSONPath expression against this JSON document. |
| Evaluate(JsonDocument?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode) | Evaluates using cooperative cancellation and resource limits. |
| Evaluate(JsonElement, JsonPath) | Evaluates a JSONPath expression against this JSON element. |
| Evaluate(JsonElement, JsonPath, JsonPathEvaluationMode) | Evaluates a JSONPath expression against this JSON element. |
| Evaluate(JsonElement, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode) | Evaluates using cooperative cancellation and resource limits. |
| Evaluate(JsonNode?, JsonPath) | Evaluates a JSONPath expression against this JSON value. |
| Evaluate(JsonNode?, JsonPath, JsonPathEvaluationMode) | Evaluates a JSONPath expression against this JSON value. |
| Evaluate(JsonNode?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode) | Evaluates using cooperative cancellation and resource limits. |
| EvaluateValue(JsonDocument?, JsonPath) | Evaluates a JSONPath expression against this JSON document and returns the first matched value, or null when there is no match. |
| EvaluateValue(JsonDocument?, JsonPath, JsonPathEvaluationMode) | Evaluates a JSONPath expression against this JSON document and returns the first matched value, or null when there is no match. |
| EvaluateValue(JsonDocument?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode) | Returns the first value using cooperative cancellation and resource limits. |
| EvaluateValue(JsonElement, JsonPath) | Evaluates a JSONPath expression against this JSON element and returns the first matched value, or null when there is no match. |
| EvaluateValue(JsonElement, JsonPath, JsonPathEvaluationMode) | Evaluates a JSONPath expression against this JSON element and returns the first matched value, or null when there is no match. |
| EvaluateValue(JsonElement, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode) | Returns the first value using cooperative cancellation and resource limits. |
| EvaluateValue(JsonNode?, JsonPath) | Evaluates a JSONPath expression against this JSON value and returns the first matched value, or null when there is no match. |
| EvaluateValue(JsonNode?, JsonPath, JsonPathEvaluationMode) | Evaluates a JSONPath expression against this JSON value and returns the first matched value, or null when there is no match. |
| EvaluateValue(JsonNode?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode) | Returns the first value using cooperative cancellation and resource limits. |
Evaluate overloads
Evaluate(JsonDocument?, JsonPath)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON document.
public static JsonPathResult<JsonElement> Evaluate(this JsonDocument? root, JsonPath path)Parameters
rootJsonDocument?- The root JSON document to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
Returns
JsonPathResult<JsonElement> A JsonPathResult<TValue> containing all matched nodes.
Exceptions
ArgumentNullExceptionpathisnull.
Evaluate(JsonDocument?, JsonPath, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON document.
public static JsonPathResult<JsonElement> Evaluate(this JsonDocument? root, JsonPath path, JsonPathEvaluationMode mode)Parameters
rootJsonDocument?- The root JSON document to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
modeJsonPathEvaluationMode- The evaluation mode.
Returns
JsonPathResult<JsonElement> A JsonPathResult<TValue> containing all matched nodes.
Exceptions
ArgumentNullExceptionpathisnull.JsonPathEvaluationException- The path cannot be evaluated in
JsonPathEvaluationMode.Strictmode.
Evaluate(JsonDocument?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates using cooperative cancellation and resource limits.
public static JsonPathResult<JsonElement> Evaluate(this JsonDocument? root, JsonPath path, JsonPathEvaluationOptions options, JsonPathEvaluationMode mode = JsonPathEvaluationMode.Lax)Parameters
rootJsonDocument?pathJsonPathoptionsJsonPathEvaluationOptionsmodeJsonPathEvaluationMode
Returns
Evaluate(JsonElement, JsonPath)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON element.
public static JsonPathResult<JsonElement> Evaluate(this JsonElement root, JsonPath path)Parameters
rootJsonElement- The root JSON element to query.
pathJsonPath- The JSONPath expression to evaluate.
Returns
JsonPathResult<JsonElement> A JsonPathResult<TValue> containing all matched nodes.
Exceptions
ArgumentNullExceptionpathisnull.
Evaluate(JsonElement, JsonPath, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON element.
public static JsonPathResult<JsonElement> Evaluate(this JsonElement root, JsonPath path, JsonPathEvaluationMode mode)Parameters
rootJsonElement- The root JSON element to query.
pathJsonPath- The JSONPath expression to evaluate.
modeJsonPathEvaluationMode- The evaluation mode.
Returns
JsonPathResult<JsonElement> A JsonPathResult<TValue> containing all matched nodes.
Exceptions
ArgumentNullExceptionpathisnull.JsonPathEvaluationException- The path cannot be evaluated in
JsonPathEvaluationMode.Strictmode.
Evaluate(JsonElement, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates using cooperative cancellation and resource limits.
public static JsonPathResult<JsonElement> Evaluate(this JsonElement root, JsonPath path, JsonPathEvaluationOptions options, JsonPathEvaluationMode mode = JsonPathEvaluationMode.Lax)Parameters
rootJsonElementpathJsonPathoptionsJsonPathEvaluationOptionsmodeJsonPathEvaluationMode
Returns
Evaluate(JsonNode?, JsonPath)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON value.
public static JsonPathResult Evaluate(this JsonNode? root, JsonPath path)Parameters
rootJsonNode?- The root JSON value to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
Returns
JsonPathResult A JsonPathResult containing all matched nodes.
Exceptions
ArgumentNullExceptionpathisnull.
Evaluate(JsonNode?, JsonPath, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON value.
public static JsonPathResult Evaluate(this JsonNode? root, JsonPath path, JsonPathEvaluationMode mode)Parameters
rootJsonNode?- The root JSON value to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
modeJsonPathEvaluationMode- The evaluation mode.
Returns
JsonPathResult A JsonPathResult containing all matched nodes.
Exceptions
ArgumentNullExceptionpathisnull.JsonPathEvaluationException- The path cannot be evaluated in
JsonPathEvaluationMode.Strictmode.
Evaluate(JsonNode?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates using cooperative cancellation and resource limits.
public static JsonPathResult Evaluate(this JsonNode? root, JsonPath path, JsonPathEvaluationOptions options, JsonPathEvaluationMode mode = JsonPathEvaluationMode.Lax)Parameters
rootJsonNode?pathJsonPathoptionsJsonPathEvaluationOptionsmodeJsonPathEvaluationMode
Returns
EvaluateValue overloads
EvaluateValue(JsonDocument?, JsonPath)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON document and returns the first matched value, or null when there is no match.
public static JsonElement? EvaluateValue(this JsonDocument? root, JsonPath path)Parameters
rootJsonDocument?- The root JSON document to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
Returns
JsonElement? The first matched value, or null when there is no match.
Exceptions
ArgumentNullExceptionpathisnull.
EvaluateValue(JsonDocument?, JsonPath, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON document and returns the first matched value, or null when there is no match.
public static JsonElement? EvaluateValue(this JsonDocument? root, JsonPath path, JsonPathEvaluationMode mode)Parameters
rootJsonDocument?- The root JSON document to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
modeJsonPathEvaluationMode- The evaluation mode.
Returns
JsonElement? The first matched value, or null when there is no match.
Exceptions
ArgumentNullExceptionpathisnull.JsonPathEvaluationException- The path cannot be evaluated in
JsonPathEvaluationMode.Strictmode.
EvaluateValue(JsonDocument?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode)
JsonPathExtensions.csReturns the first value using cooperative cancellation and resource limits.
public static JsonElement? EvaluateValue(this JsonDocument? root, JsonPath path, JsonPathEvaluationOptions options, JsonPathEvaluationMode mode = JsonPathEvaluationMode.Lax)Parameters
rootJsonDocument?pathJsonPathoptionsJsonPathEvaluationOptionsmodeJsonPathEvaluationMode
Returns
EvaluateValue(JsonElement, JsonPath)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON element and returns the first matched value, or null when there is no match.
public static JsonElement? EvaluateValue(this JsonElement root, JsonPath path)Parameters
rootJsonElement- The root JSON element to query.
pathJsonPath- The JSONPath expression to evaluate.
Returns
JsonElement? The first matched value, or null when there is no match.
Exceptions
ArgumentNullExceptionpathisnull.
EvaluateValue(JsonElement, JsonPath, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON element and returns the first matched value, or null when there is no match.
public static JsonElement? EvaluateValue(this JsonElement root, JsonPath path, JsonPathEvaluationMode mode)Parameters
rootJsonElement- The root JSON element to query.
pathJsonPath- The JSONPath expression to evaluate.
modeJsonPathEvaluationMode- The evaluation mode.
Returns
JsonElement? The first matched value, or null when there is no match.
Exceptions
ArgumentNullExceptionpathisnull.JsonPathEvaluationException- The path cannot be evaluated in
JsonPathEvaluationMode.Strictmode.
EvaluateValue(JsonElement, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode)
JsonPathExtensions.csReturns the first value using cooperative cancellation and resource limits.
public static JsonElement? EvaluateValue(this JsonElement root, JsonPath path, JsonPathEvaluationOptions options, JsonPathEvaluationMode mode = JsonPathEvaluationMode.Lax)Parameters
rootJsonElementpathJsonPathoptionsJsonPathEvaluationOptionsmodeJsonPathEvaluationMode
Returns
EvaluateValue(JsonNode?, JsonPath)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON value and returns the first matched value, or null when there is no match.
Parameters
rootJsonNode?- The root JSON value to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
Returns
JsonNode? The first matched value, or null when there is no match.
Exceptions
ArgumentNullExceptionpathisnull.
EvaluateValue(JsonNode?, JsonPath, JsonPathEvaluationMode)
JsonPathExtensions.csEvaluates a JSONPath expression against this JSON value and returns the first matched value, or null when there is no match.
public static JsonNode? EvaluateValue(this JsonNode? root, JsonPath path, JsonPathEvaluationMode mode)Parameters
rootJsonNode?- The root JSON value to query. May be
null. pathJsonPath- The JSONPath expression to evaluate.
modeJsonPathEvaluationMode- The evaluation mode.
Returns
JsonNode? The first matched value, or null when there is no match.
Exceptions
ArgumentNullExceptionpathisnull.JsonPathEvaluationException- The path cannot be evaluated in
JsonPathEvaluationMode.Strictmode.
EvaluateValue(JsonNode?, JsonPath, JsonPathEvaluationOptions, JsonPathEvaluationMode)
JsonPathExtensions.csReturns the first value using cooperative cancellation and resource limits.
public static JsonNode? EvaluateValue(this JsonNode? root, JsonPath path, JsonPathEvaluationOptions options, JsonPathEvaluationMode mode = JsonPathEvaluationMode.Lax)Parameters
rootJsonNode?pathJsonPathoptionsJsonPathEvaluationOptionsmodeJsonPathEvaluationMode