Getting JSON response instead of CSV response for flux query REST call

I tried API references using the following documents:

https://docs.influxdata.com/influxdb/v1.8/tools/api/
https://docs.influxdata.com/influxdb/v2.0/reference/api/

Although influxQL query returns JSON response, flux query returns CSV response. Is there a way to return flux query in JSON format?