title: How can I pretty-print JSON using node.js?
body: <p>This seems like a solved problem but I am unable to find a solution for it.</p>
  
  <p>Basically, I read a JSON file, change a key, and write back the new JSON to the same file. All works, but I loose the JSON formatting.So, instead of:</p>
  
  <pre><code>{
    name:'test',
    version:'1.0'
  }
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>{name:'test',version:'1.1'}
  </code></pre>
  
  <p>Is there a way in Node.js to write well formatted JSON to file ?</p>