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: content/en/docs/reference/kubectl/jsonpath.md
+13-6Lines changed: 13 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,30 +2,34 @@
2
2
title: JSONPath Support
3
3
content_type: concept
4
4
weight: 40
5
+
math: true
5
6
---
6
7
7
8
<!-- overview -->
8
-
Kubectl supports JSONPath template.
9
+
The {{< glossary_tooltip term_id="kubectl" text="kubectl" >}} tool supports JSONPath templates as an output format.
9
10
10
11
11
12
<!-- body -->
12
13
13
-
JSONPath template is composed of JSONPath expressions enclosed by curly braces {}.
14
+
A _JSONPath template_is composed of JSONPath expressions enclosed by curly braces: `{` and `}`.
14
15
Kubectl uses JSONPath expressions to filter on specific fields in the JSON object and format the output.
15
16
In addition to the original JSONPath template syntax, the following functions and syntax are valid:
16
17
17
18
1. Use double quotes to quote text inside JSONPath expressions.
18
19
2. Use the `range`, `end` operators to iterate lists.
19
-
3. Use negative slice indices to step backwards through a list. Negative indices do not "wrap around" a list and are valid as long as `-index + listLength >= 0`.
20
+
3. Use negative slice indices to step backwards through a list.
21
+
Negative indices do _not_ "wrap around" a list and are valid as long as \\( ( - index + listLength ) \ge 0 \\).
20
22
21
23
{{< note >}}
22
24
23
25
- The `$` operator is optional since the expression always starts from the root object by default.
24
26
25
-
- The result object is printed as its String() function.
27
+
- The result object is printed as its `String()` function.
26
28
27
29
{{< /note >}}
28
30
31
+
## Functions in Kubernetes JSONPath {#functions}
32
+
29
33
Given the JSON input:
30
34
31
35
```json
@@ -70,6 +74,7 @@ Given the JSON input:
70
74
}
71
75
```
72
76
77
+
{{< table caption="Functions, their parameters, an example invocation, and the result" >}}
0 commit comments