C API: jq program invocation - jqlang/jq GitHub Wiki
TBD
-
The libjq public API is declared in
jq.h
andjv.h
. There is no documentation at this time. Use the source code, and in particular seemain.c:main()
. -
Hint: the API in
jv.h
is for dealing with parsed JSON values, while the API injq.h
is for evaluating jq programs. Usejq_init()
to allocate ajq_state *
value, then usejq_compile_args()
to compile a jq program, then usejq_start()
to get ready to evaluate it on one input value, and then repeatedly calljq_next()
to extract all the output values that the program produces. Termination is indicated byjq_next()
outputting an invalid value (without a message), while errors are indicated byjq_next()
outputting an invalid value with a message. When done, usejq_teardown()
to release thejq_state *
value.