You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/current/v25.2/jsonpath.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ A JSONPath expression has the following generic structure:
18
18
-`mode` is an optional mode (`lax` or `strict`) that determines how structural mismatches are tolerated. If not specified, the mode is `lax`. Refer to [Structural error handling](#structural-error-handling).
19
19
-`$` is the root of the JSONPath, and must be the first element in a JSONPath expression. For an example, refer to [Access entire document](#access-entire-document).
20
20
-`.key` is an optional key accessor that refers to a named field in a `JSONB` object. To access array elements, use `.key[index]` or `.key[*]`. Each successive key accessor navigates one level deeper into the structure. `.*` matches all fields in the current object.
21
-
-`? (filter_exp)` is an optional filter expression that evaluates the path according to a [predicate check expression](#check-expression), only returning the results that match. For syntax details, refer to [Filter expressions](#filter-expressions).
21
+
-`? (filter_exp)` is an optional filter expression that evaluates the path according to a [predicate check expression](#check-expressions), only returning the results that match. For syntax details, refer to [Filter expressions](#filter-expressions).
22
22
-`method` is an optional [JSONPath method](#jsonpath-methods) that can be used to access or transform the current path value.
23
23
24
24
The path is evaluated left to right, and each stage refines or filters the result.
@@ -27,13 +27,13 @@ The path is evaluated left to right, and each stage refines or filters the resul
27
27
28
28
Use JSONPath functions to extract or evaluate target `JSONB` data according to a specified [path](#jsonpath-expression). For full details on JSONPath functions, refer to [Functions and Operators]({% link {{ page.version.version }}/functions-and-operators.md %}# jsonpath-functions).
|`jsonb_path_exists(jsonb, jsonpath)`| Returns true if any match is found. |`false`|
33
-
|`jsonb_path_match(jsonb, jsonpath)`| Returns true if the path expression evaluates to true. Only useful with [predicate check expressions](#predicate-check-expressions), as it expects a single Boolean value. |`false`|
34
-
|`jsonb_path_query(jsonb, jsonpath)`| Returns all matches as a set of `JSONB` values. |`NULL`|
35
-
|`jsonb_path_query_array(jsonb, jsonpath)`| Returns all matches as a single `JSONB` array. |`[]`|
36
-
|`jsonb_path_query_first(jsonb, jsonpath)`| Returns the first match only. |`NULL`|
|`jsonb_path_exists(jsonb, jsonpath)`| Returns true if any match is found. |`false`|
33
+
|`jsonb_path_match(jsonb, jsonpath)`| Returns true if the path expression evaluates to true. Only useful with [predicate check expressions](#check-expressions), as it expects a single Boolean value. |`false`|
34
+
|`jsonb_path_query(jsonb, jsonpath)`| Returns all matches as a set of `JSONB` values. |`NULL`|
35
+
|`jsonb_path_query_array(jsonb, jsonpath)`| Returns all matches as a single `JSONB` array. |`[]`|
36
+
|`jsonb_path_query_first(jsonb, jsonpath)`| Returns the first match only. |`NULL`|
37
37
38
38
Each function accepts two required and two optional arguments as follows:
39
39
@@ -155,7 +155,7 @@ SELECT jsonb_path_query(data, '$.season') FROM stats;
155
155
"2023-24"
156
156
~~~
157
157
158
-
To access nested keys, append key accessors to their parent keys. The following query returns the `stats` value for each element in the `players` array, using the [array accessor](#access-array-elements):
158
+
To access nested keys, append key accessors to their parent keys. The following query returns the `stats` value for each element in the `players` array, using the [array accessor](#access-jsonb-array-elements):
Define a variable in a JSONPath expression by prefixing it with `$`. Then specify a value as an argument in the [JSONPath function](#jsonpath-function).
422
+
Define a variable in a JSONPath expression by prefixing it with `$`. Then specify a value as an argument in the [JSONPath function](#jsonpath-functions).
423
423
424
424
The following query filters players whose `ppg` is greater than the value of the `min` variable:
425
425
@@ -518,7 +518,7 @@ ERROR: jsonpath member accessor can only be applied to an object
518
518
SQLSTATE: 2203A
519
519
~~~
520
520
521
-
However, setting `silent` to `true` in a [JSONPath function](#jsonpath-function) suppresses any errors:
521
+
However, setting `silent` to `true` in a [JSONPath function](#jsonpath-functions) suppresses any errors:
0 commit comments