Filters can be used in expressions to perform some transformations on variables such as formatting a date, converting a string to uppercase, or joining a list of strings.
Filters are separated from the variable name by a pipe symbol |
. Multiple filters can be chained together so that the output of one filter is applied to the next one.
The following example turns the name into title case:
{{ name | title }}
Filters that accept arguments have parentheses around the arguments. This example joins the elements of a list into a string, with list elements separated by commas:
{{ list | join(', ') }}
To apply a filter on a section of code, wrap it with the filter
tag:
{% filter lower | title %}
hello
{% endfilter %}
Each section below represents a built-in filter type.
JSON Filters
JSON filters are used to manipulate JSON objects, often API responses.
Numeric Filters
Numeric filters are used to format numbers or convert strings to numbers.
Object Filters (Maps, Arrays and More)
Object filters help you manipulate maps and arrays.
String Filters
String filters are used to manipulate strings i.e. textual data.
Temporal Filters
Temporals filters are used to format dates and timestamps.
YAML Filters
YAML filters are used to turn YAML strings into objects.
Was this page helpful?