title: AngularJS Convert Array to JSON
body: <p>I have an array containing 3 elements</p>
  
  <pre><code>var a = [];
    a["username"]=$scope.username;
    a["phoneNo"]=$scope.phoneNo;
    a["altPhoneNo"]=$scope.altPhoneNo;
  </code></pre>
  
  <p>Now, I want to send this data to server in JSON format. Therefore, I used</p>
  
  <pre><code>    var aa = JSON.stringify(a);
      console.log("aa = "+aa);
  </code></pre>
  
  <p>But the console displays empty array </p>
  
  <pre><code>aa = [] 
  </code></pre>
  
  <p>How can I convert this array into JSON?</p>