title: Edit json in js/node.js?
body: <p>I am working on an nodejs app which reads data from a json file. Now I want to edit this json file in js (write to it). How do I do this ? </p>
  
  <p>Here is my js code: `</p>
  
  <pre><code>var fs = require("fs")
  
  //function for file input
  function getFile(filename) {
    var data = fs.readFileSync(filename,"ascii")
    return data }
  
  //parsing json
  var jsonString = [getFile("File.json")]
  var jsonObj = JSON.parse(jsonString)`
  </code></pre>