jq icon indicating copy to clipboard operation
jq copied to clipboard

Wishlist: Flag to verify filter syntax

Open VictorEngmarkHexagon opened this issue 6 months ago • 3 comments

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

  1. not relying on shell features like standard input to pass some valid JSON to run the filter against, and
  2. 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.jq and the like work, but rely on standard input.

VictorEngmarkHexagon avatar Jul 16 '25 07:07 VictorEngmarkHexagon