python-json-via-jinja2-render

About

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…

Known limitations

Requirements

Usage


render.py --help

Examples

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

Docker

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

Running in container with custom templates

cat 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

Testing