Hi Everyone,
i build an Array for a JSON Object.
for(var v in data) {
records.push({
month: v,
ship : data[v]
});
}
Before, i looped through a Database which gaves me, in every loop a String with a Ship Name.
var ship = "RANDOMSHIPNAME";
Now, i want to insert the string var ship into to the JSON Array.
But, this is not working, the JSON Object wirting still "ship" in it, instead of the real string value.
The JSON String should look like this, if everything would work fine:
"records":[
{"month":"12","RANDOMSHIPNAME":2},
{"month":"5","RANDOMSHIPNAME":5},
{"month":"8","RANDOMSHIPNAME_TWO":1}
]
Regards and Thanks,
Sven