title: How to update a value in a json file and save it through node.js
body: <p>How do I update a value in a json file and save it through node.js?
  I have the file content:</p>
  
  <pre><code>var file_content = fs.readFileSync(filename);
  var content = JSON.parse(file_content);
  var val1 = content.val1;
  </code></pre>
  
  <p>Now I want to change the value of <code>val1</code> and save it to the file.</p>