I am working with an object from a PHP API that looks like this:
[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 result should be:
## Particular Loan Class 1 Loan Class 2 Loan Class 3 ##
I attempted to achieve this using the following code:
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';
This is how the CSV appears:
## span caption master ##
Please advise on extracting the caption values and if there is a script available to export this to excel as merging of columns is necessary.