Very simple script to get json input, pass it via Jinja2 template to get the output.
Why? Sometimes I got some simple json file and I want to process it into something easier to read, for example text file or html.
Other tools usually do too much already, like extra connecting to internet idk why…
render.py --help
test.sh
for exact usage.test_extra.sh
for more complex examples, also see at the bottom some intereting use cases.examples/
and `‘templates/’ directory for input/output and template files.Name | Input | Template | Output |
---|---|---|---|
wagoodman/dive HTML | input | template | output |
wagoodman/dive plain text | input | template | output |
AWS ECR security scan CSV | input | template | output |
AWS ECR security scan CSV for failed scan | input | template | output |
AWS ECR security scan HTML | input | template | output |
AWS ECR security scan HTML for failed scan | input | template | output |
AWS ECR security scan plaintext long | input | template | output |
AWS ECR security scan plaintext long for failed scan | input | template | output |
AWS ECR security scan plaintext short | input | template | output |
AWS ECR security scan plaintext short for failed scan | input | template | output |
docker inspect plain text to simulate YAML cause we can! | input | template | output |
skopeo stdout plaintext as MarkDown | input | template | output |
cat examples/aws_ecr_scan_result.json \
| docker run -v $(pwd)/templates/:/app/templates:ro \
-i quay.io/kaszpir/python-json-via-jinja2-render \
-t templates/aws_ecr_scan_result_html.j2 \
> output.html
or with stdin/stdout:
docker run \
-v "$(pwd)/templates/:/app/templates:ro" \
-i quay.io/kaszpir/python-json-via-jinja2-render \
-t templates/aws_ecr_scan_result_html.j2 \
<examples/aws_ecr_scan_result.json \
>output.html
my_template
dir with desired templatemy_template/custom.j2
file which is tailored to your json input filescat examples/aws_ecr_scan_result.json \
| docker run -v $(pwd)/my_template/:/app/templates:ro \
-i quay.io/kaszpir/python-json-via-jinja2-render \
-t templates/custom.j2 \
>output.html
./test.sh