Hy guys, Given an array of JSON objects, I'd like to output a CSV, but in this case i have a different keys and i need to take some values through JSONs' multiple layers.
i'm not skill with a bash script. i have found that link Convert json to csv using jq with different key but I don't know how to adapt it to my case
My Json file:
{
"status": "success",
"data": {
"n_per_page": 10,
"transactions_by_dealer_code": {
"06001": [
{
"dealer_name": "Pippo",
"dealer_total_transaction_count": 0,
"dealer_cancellation_count": 0,
"dealer_reservation_count": 0,
"transactons_detail": []
}
],
"06003": [
{
"dealer_name": "Pluto",
"dealer_total_transaction_count": 1,
"dealer_cancellation_count": 0,
"dealer_reservation_count": 1,
"transactons_detail": [
{
"transaction_id": "123456789",
"deposite_amount": 0.01,
"vehicle_make": "ferrari"
}
]
}
]
}
}
}
the correct output:
06001,Pippo,,,,
06002,Pluto,123456789,0.01,ferrari
Thanks all.