title: Add to json list in Node.js
body: <p>I am very new to Node and I am saving my data in a json file, and I want to dynamically add people to a json list. How would I go about this?</p>
  
  <p>JSON:</p>
  
  <pre><code>{
    "people": []
  }
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>const fs = require('fs');
  
  function addPerson() {
    var jsonFile = fs.readFileSync("/Users/Nick/Desktop/Js/names.js");
    var content = JSON.parse(jsonFile);
    var newPerson = {
      "fname": "John",
      "lname": "Davis",
      "job": "developer"
    };
    content.people.push(newPerson);
  }
  
  addPerson()
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>undefined:1
  const fs = require('fs');
  ^
  
  SyntaxError: Unexpected token c in JSON at position 0
  </code></pre>