I have a JSON as follows:
{
"workloadId": "68cf9344-5a3c-4e4a-927c-c1c9b6e48ccc",
"elements": [
{
"name": "element1",
"uri": "vm/hpcloud/nova/large"
},
{
"name": "element2",
"uri": "vm/hpcloud/nova/small"
}
],
"workloadStatus": "none"
}
I need to get the comma seperated string as follows : element1,element2
when i tried as given below , i got empty string:
app.post('/pricingdetails', function(req, res) {
var workload = req.body;
var arr = new Array();
for(var index in workload.elements)
{
arr[index] = workload.elements[index].uri;
}
console.log(arr.join(","));
}