jq is a handy tool for writing shell scripts, but it's also frustrating.
Perl (5.14+) provides JSON::PP which can handle the json parsing side of things. Evaluating then becomes a problem for Perl instead of another programming language.
--slurpfile is pretty magical, but it's only used in one place
wrap_in_json is a function, so replacing it should be pretty easy
wrap_file_in_json is a function, so replacing it should be pretty easy
jq -s is used once
jq --arg is used once in a call curl which could be replaced by
jq length is used once
-r has a handful of other uses which probably should all have
jq -r is used >80 times -- they're all fairly simple, but replacing them will probably happen as more code is refactored from shell to perl