Skip to main content

About as_native filter

The as_native Jinja filter will coerce Jinja-compiled output into its Python native representation according to ast.literal_eval. The result can be any Python native type (set, list, tuple, dict, etc).

To render boolean and numeric values, it is recommended to use as_bool and as_number instead.

Proceed with caution

Unlike as_bool and as_number, as_native will return a rendered value regardless of the input type. Ensure that your inputs match expectations.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0