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/chart_template_guide/function_list.md
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -701,6 +701,7 @@ The following type conversion functions are provided by Helm:
701
701
-`fromJson`: Convert a JSON string to an object.
702
702
-`fromJsonArray`: Convert a JSON array to a list.
703
703
-`toYaml`: Convert list, slice, array, dict, or object to indented yaml, can be used to copy chunks of yaml from any source. This function is equivalent to GoLang yaml.Marshal function, see docs here: https://pkg.go.dev/gopkg.in/yaml.v2#Marshal
704
+
-`toYamlPretty`: Convert list, slice, array, dict, or object to indented yaml. Equivalent to `toYaml` but will additionally indent lists by 2 spaces.
704
705
-`toToml`: Convert list, slice, array, dict, or object to toml, can be used to copy chunks of toml from any source.
705
706
-`fromYamlArray`: Convert a YAML array to a list.
706
707
@@ -826,6 +827,32 @@ greeting: |
826
827
{{ end }}
827
828
```
828
829
830
+
### toYaml, toYamlPretty
831
+
832
+
The `toYaml` and `toYamlPretty` functions encode an object (list, slice, array, dict, or object) into an indented YAML string.
833
+
834
+
> Note that `toYamlPretty` is functionally equivalent but will output YAML with additional indents for list elements
835
+
836
+
```yaml
837
+
# toYaml
838
+
- name: bob
839
+
age: 25
840
+
hobbies:
841
+
- hiking
842
+
- fishing
843
+
- cooking
844
+
```
845
+
846
+
```yaml
847
+
# toYamlPretty
848
+
- name: bob
849
+
age: 25
850
+
hobbies:
851
+
- hiking
852
+
- fishing
853
+
- cooking
854
+
```
855
+
829
856
### fromYamlArray
830
857
831
858
The `fromYamlArray` function takes a YAML Array and returns a list that can be used in templates.
@@ -1578,7 +1605,7 @@ $myList := list 1 2 3 4 5
1578
1605
The above creates a list of `[1 2 3 4 5]`.
1579
1606
1580
1607
Helm provides the following list functions: [append
0 commit comments