Magic Code Samples

Jinja code examples for tricky things.

Email parsing

How to get [email protected] the first and last name in two variables in Jinja?

{% set first, last = email.split("@")[0].split(".") %} 
{{ first }} {{ last }}

How to get the myname of [email protected] before the @ nicely, e.g. to use as a first name?

{% set first = email.split("@")[0] %}
{{ first }}

Mapping to lists

If you have two lists, one of which can be nested, and you want to combine items of it, do as follows:

List 1 called list_1:

{
    "items": [
        {
            "taxCode": "23456",
            "salesTaxRate": {
                "taxRate": "0.0001"
            }
        }
    ]
}

List 2 called list_2:

In the Dict Helper > Define variable:

Last updated

Was this helpful?