$ uv tool install jinja2-cli
# or
$ pip install jinja2-cli
$ jinja2 template.j2 data.json --format json
$ cat data.json | jinja2 template.j2 - --format json
$ jinja2 template.j2 data.json --format json -D foo=bar -D answer=42
- If a data file is provided,
--format auto(default) uses the file extension. - If stdin is used, it defaults to YAML when available, otherwise JSON.