I have 2 CSV files and I want to grab specific data (while ignoring some columns) from the CSVs and turn them into a JSON format with nested arrays and specific key names. I also want to order the JSON by a specific value (orderID).
Here's an example:
CSV file 1:
[ORDERIDENTIFIER, ORDERDTE, STORESTE, STOREADDRESS, STOREZIP, PRODUCTTYPE]
CSV File 2:
[ORDERTYPE, CUSTOMERAGE, CITY]
JSON:
[
{
"storeOrders": {
"orderType": "2",
"orderID": "22222",
"orderDetails": {
"productType": "Standard"
},
"collectedOrders": [
{
"orderDate": "2023-09-03",
"customerAge": "22"
}
],
"storeDetails": {
"storeState": "IA"
}
}
},
{
"storeOrders": {
"orderType": "1",
"orderID": "444",
"orderDetails": {
"productType": "Standard"
},
"collectedOrders": [
{
"orderDate": "2023-06-03",
"customerAge": "60"
}
],
"storeDetails": {
"storeState": "RI"
}
}
}
]
I have tried using the csvtojson but am unsure how to use it for multiple files/changing key names`