title: Put all credential to file .json
body: <p>i am new at Javascript, and i still confuse about javascript and using json file. I working at one of my office project about sending a message, i have been complete all the code at back-end and front-end, but when the code was review with my project leader, he say to put all the credential to file json. To send a message / mail, i using nodemailer from node.js</p>
  <p>Here is the credential i have to put in json file</p>
  <pre><code>const transporter = mail.createTransport({ //unresolved
    service: 'Gmail',
    host: 'smtp.gmail.com',
    auth: {
      user: 'no.replyxx@xx.org',
      pass: 'xxxxxx'
    }
  });
  </code></pre>
  <p>I have put it into the json file, but when i call it at my javascript file, i don't know how to call it, i try to import a json file, but i just get bug for it can someone help me, precisely my question is how i write a credential to json file and how i use it at my javascript? Thanks</p>