#!/bin/sh -e
# shellcheck enable=

nested () {
    ex=$1

    if [ -n "$ex" ]
    then
        shift
        jq -r "$ex" | nested "$@"
    else
        jq .
    fi
}

f=$1
shift

nested "$@" < "$f"
