I am trying to convert JSON file from the command below to CSV format:
curl -X GET 'https://api.coinex.com/v1/market/kline?market=BCHBTC&type=1min' -H "Accept: application/json"
I tried jq command as following, but it was unsuccessful :
jq '.data |to_entries[] | @csv'
OR
jq '.data |to_entries[] | [.key, (.0|tonumber),(.1|tonumber),(.2|tonumber),(.3|tonumber),(.4|tonumber),(.5|tonumber),(.6|tonumber),(.7|tonumber) )] | @csv'
desired output is like:
1619094720 0.01738857 0.01742868 0.01742868 0.01737360 1.24151689 0.0215974650849251 BCHBTC
1619094780 0.01742823 0.01742913 0.01742913 0.01742807 0.89060000 0.0155215977170000 BCHBTC
1619094840 0.01744941 0.01745423 0.01745423 0.01744941 0.42820000 0.0074724290140000 BCHBTC
1619094900 0.01745458 0.01740857 0.01745458 0.01740857 0.73530000 0.0128245470890000 BCHBTC