Skip to content

C API: jq program invocation

gitahi edited this page Feb 13, 2024 · 3 revisions

TBD

  • The libjq public API is declared in jq.h and jv.h. There is no documentation at this time. Use the source code, and in particular see main.c:main().

  • Hint: the API in jv.h is for dealing with parsed JSON values, while the API in jq.h is for evaluating jq programs. Use jq_init() to allocate a jq_state * value, then use jq_compile_args() to compile a jq program, then use jq_start() to get ready to evaluate it on one input value, and then repeatedly call jq_next() to extract all the output values that the program produces. Termination is indicated by jq_next() outputting an invalid value (without a message), while errors are indicated by jq_next() outputting an invalid value with a message. When done, use jq_teardown() to release the jq_state * value.

Clone this wiki locally