I have this object from a PHP API:
[Object { span=1,  caption="Particular",  master=true},
Object { span=5,  caption="Loan Class 1"},
Object { span=5,  caption="Loan Class 2"},
Object { span=5,  caption="Loan Class 3"}]
The desired output would be:
## Particular   Loan Class 1    Loan Class 2  Loan Class 3 ##
I tried to do this :
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
for (var index in arrData[0]) {
row += index + ',';}
row = row.slice(0, -1);
CSV += row + '\r\n';
What the csv looks like
## span   caption   master ##  
Please help how to get the caption value and if there's a script that will output this in excel since there is a need to add some merging of columns.
 
     
     
    