I want to convert a nested json to csv file using node.js. my JSON structure:
[
{
"Make": "Nissan",
"Model": "Murano",
"Year": "2013",
"Specifications": {
"Mileage": "7106",
"Trim": "SAWD"
},
"Items": [
{
"flavor": {
"name": "Cherry",
"id": 1
},
"packSize": {
"name": "200ML",
"id": 1
}
},
{
"flavor": {
"name": "Vanilla",
"id": 2
},
"packSize": {
"name": "300ML",
"id": 2
}
}
]
},
{
"Make": "BMW",
"Model": "X5",
"Year": "2014",
"Specifications": {
"Mileage": "3287",
"Trim": "M"
},
"Items": [
{
"flavor": {
"name": "Cherry",
"id": 1
},
"packSize": {
"name": "200ML",
"id": 1
}
},
{
"flavor": {
"name": "Vanilla",
"id": 2
},
"packSize": {
"name": "300ML",
"id": 2
}
}
]
}
]
I have used 'json-2-csv' module but it only converts the simple structure not the nested structure. only the 'make','model','year' and 'specification' is converted,'items' are not converted How to do this???
