Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 582

JSON to CSV using jq or python [closed]

$
0
0

Need help converting this JSON and using a specific element of the Column Dimension as the Column header line in CSV using jq

Input JSONyour text

{"Columns": [        {"Id": "ItemName","IsEditable": false        },        {"Id": "Date","IsEditable": false        },        {"Id": "Qty","IsEditable": false        }    ],"Rows": [        {"Values": ["ITEM1","10-MAY-2024","100"            ]        },        {"Values": ["ITEM2","20-MAY-2024","200"            ]        },        {"Values": ["ITEM3","30-MAY-2024","400"            ]        }    ],"QueryHandle": {"QueryID": "00101","Worksheet": {"Name": "Test20","Scope": "NA"        },"WorkAlloc": "2024-MAY"    },"RowCount": 3}

Required Output in CSV format ( I only the data below and the rest of the elements in JSON to be ignored).

The header columns come from .Columns[]|.Id

ItemName, Date, Qty"Item1","10-MAY-2024","100""Item2","20-MAY-2024","200""Item3","20-MAy-2024","400"

Tried following this post:

How to convert arbitrary simple JSON to CSV using jq?

but haven't been able to get it to work


Viewing all articles
Browse latest Browse all 582

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>