0👍
✅
Have you tried this one?
var prefinallds = [];
for(i = 0; i < actual_JSON.length-1; i++){
var data = {};
dslabel = actual_JSON[i].Client;
dsdata = actual_JSON[i].Customer +"," +actual_JSON[i].Internal;
gcolor = dsbgcolor[i];
borcolor = dsborcolo[i];
if(i == actual_JSON.length-2)
{
data.label = dslabel;
data.data = dsdata;
data.backgroundColor = dsbgcolor[i];
data.borderColor = dsborcolo*emphasized text*[i];
data.radius = rad;
}
else
{
data.label = dslabel;
data.data = dsdata;
data.backgroundColor = dsbgcolor[i];
data.borderColor = dsborcolo*emphasized text*[i];
data.radius = rad;
}
prefinallds.push(data);
}
// convert to json
JSON.parse(prefinallds);
You tried to convert a string into JSON
format which is not recommended. I strongly courage developers to use an actual object to parse their data.
Source:stackexchange.com