title: Array only showing last result of the loop - JAVASCRIPT
body: <p>i want to get the full list of my google contacts on a JSON file, but im only getting the last value on my contacts.</p>
  <p>What should i change? or what is the problem here?</p>
  <pre><code>function contactsJSON() {
  
    var contactsjson = {}
    var myContacts = ContactsApp.getContactGroup('System Group: My Contacts').getContacts();
    for (var i = 0; i &lt; myContacts.length; i++) {
  
      var id = myContacts[i].getId();
      var name = myContacts[i].getFullName();
  
      var emailsobj = myContacts[i].getEmails();
      var email = {}
      for (var j = 0; j &lt; emailsobj.length; j++) {
        email[emailsobj[j].getAddress().toLowerCase()] = 1;
      };
  
      var phonesobj = myContacts[i].getPhones();
      var phone = {}
      for (var j = 0; j &lt; phonesobj.length; j++) {
        phone[phonesobj[j].getPhoneNumber().replace(/[_)(\s.-]/g, '')] = 1;
  
      };
  
      for (var j = 0; j &lt; id.length; j++) {
        contactsjson = { id: id, name: name, phone: phone, email: email };
      }
    }
  
    contactsjson = JSON.stringify(contactsjson);
    contactsjson = JSON.parse(contactsjson);
    Logger.log(contactsjson);
    return contactsjson;
  }
  
  </code></pre>
  <p>Hope you can help me,</p>
  <p>Federico.</p>