jq
jq copied to clipboard
Wishlist: Flag to verify filter syntax
After writing a small handful of larger jq filters, one thing which would be really useful would be some way to verify that a filter is syntactically valid, without actually running it on any particular JSON input. Ideally in a way which is easily integrated into pre-commit, which would mean
- not relying on shell features like standard input to pass some valid JSON to run the filter against, and
- being able to pass multiple .jq files to verify in a single command.
Workarounds:
- I tried running
jq --from-file my.jq --null-input, but that resulted in "jq: error (at): null (null) has no keys". -
jq --from-file my.jq <<< {},echo '{}' | jq --from-file my.jqand the like work, but rely on standard input.