Json output through curl on InfluxDB v2

I am setting up things with Telegraf with Jenkins plugin and InfluxDB v2.

I am using command:

curl http://localhost:9999/api/v2/query?org=ORG_NAME -XPOST -sS -H 'Authorization: Token XXXXXXX' -H 'Accept: application/csv' -H 'Content-type: application/vnd.flux' -d 'from(bucket: "jenkins") |> range(start:-5m) |> filter(fn: (r) => r._field == "result_code") |> filter(fn: (r) => r._measurement == "jenkins_stat")'

Since the curl url now takes ORG, I am not sure how can I get JSON format from the curl command.
If I try to change csv to json above this throws me error.

Appreciate your guidance.

I believe that Flux only returns data as annotated CSV and cannot return as JSON.

What do you need to do with the data after the curl? Perhaps I can help with that.

Appreciate your response @rawkode. Thank you!

Assume the status stored every 5-10mins. As part of result set every the i would like to combine and check if all are “success” or “failure” based on it i would like to expose an API to say at anypoint of time whether the jobs are Green or Red.