My array consists of three elements
var data = [];
data["username"]=$scope.username;
data["phoneNo"]=$scope.phoneNo;
data["altPhoneNo"]=$scope.altPhoneNo;
I need to send this data to the server in JSON format, so I used
var jsonData = JSON.stringify(data);
console.log("json data = "+jsonData);
However, the console is showing an empty array
json data = []
How can I properly convert this array into JSON?