title: Save html-form data in json format in a .json file using node and express with javascript
body: <p>Newbie in node and express
  I am taking user input from html-form and  trying to <strong>append or push</strong> it in a .json file.
  I have used <strong>jsonfile</strong> npm-package but it is not coming in a array format of json</p>
  
  <p>code for appending-</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  //jade --&gt; ejs --&gt;html 
  app.engine('html', require('ejs').renderFile);
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'html');
  
  var jsonfile = require('jsonfile');    
  var file = './userdata.json'
  
  
      //trying to write via form to json
      app.post('/gettingdata', function(req, res) {
          var user_id = req.body.usrid;
          var token = req.body.usrphone;
          var geo = req.body.usrdata;
  
          //start writing
          var obj = { name: user_id , phone: token, adress: geo }
          jsonfile.writeFileSync(file, obj, {flag: 'a'});
  
          //default
          //res.send(user_id + ' ' + token + ' ' + geo);
      }); 
  </code></pre>
  
  <p>html -</p>
  
  <pre><code>&lt;body&gt;
      &lt;form action="/gettingdata" method="post"&gt;
              Name:&lt;input type="text" name="usrid" /&gt;&lt;br&gt;
              Phone:&lt;input type="text" name="usrphone" /&gt;&lt;br&gt;
              RData:&lt;input type=="text" name="usrdata" /&gt;&lt;br&gt;
              &lt;input type="submit" value="Submit" &gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>json appearing as-</p>
  
  <pre><code>{"name":"name1","phone":"8989898989","adress":"random1"}
  {"name":"name1","phone":"767656568","adress":"randomdata1"}
  {"name":"name1","phone":"767656568","adress":"randomdata1"}
  </code></pre>
  
  <p>there are no commas appearing between objects and no square brackets. I need them to be able to make parsing possible, so that I can dynamically edit and delete data from my front-end later.
  Suggest any link,method or npm package to do so.If question repeated share the link of that too</p>