Back to Gems
mattrobenolt/jinja2-cli(opens in a new tab)
Language: Python
The CLI for Jinja2
- stars
- 614
- watchers
- 11
- forks
- 197
- open issues
- 14
- Last updated
- 08/12/2026
Language: Python
The CLI for Jinja2
The CLI for Jinja2.
$ jinja2 template.j2 data.json
$ curl -s http://api.example.com | jinja2 template.j2
$ uv tool install jinja2-cli
$ pip install jinja2-cli
Built-in: JSON, INI, ENV, querystring, TOML (Python 3.11+)
Optional formats via extras:
$ pip install jinja2-cli[yaml]
$ pip install jinja2-cli[xml]
$ pip install jinja2-cli[hjson]
$ pip install jinja2-cli[json5]
-D key=valueRun jinja2 --help for all options, or see docs/ for full documentation.
Extend Jinja2 with your own filters or use Ansible's extensive filter library:
# Use custom filters $ jinja2 template.j2 data.json -F myfilters # Use Ansible filters $ jinja2 template.j2 data.json -F ansible.plugins.filter.core
Example filter module:
# myfilters.py def reverse(s): return s[::-1] def shout(s): return s.upper() + "!"
See docs/filters.md for complete documentation and examples.