title: Saving JSON in Electron
body: <p>I am building an app using <a href="http://electron.atom.io/" rel="noreferrer">Electron</a>. In this app, I am building a data structure using JSON. My data structure looks like this:</p>
  
  <pre><code>{
    items: [
      { id:1, name:'football' },
      { id:2, name:'soccer ball' },
      { id:3, name:'basketball' }
    ]
  }
  </code></pre>
  
  <p>I want to save this JSON to a file called "data.json". I want to save it to a file because I want to load the next time the application starts. My challenge is, I do not know how to save the data. In fact, I'm not sure <em>where</em> I should even save the file. Do I save it in the same directory as the app? Or is there some cross-platform approach I should use?</p>
  
  <p>Currently, I have the following:</p>
  
  <pre><code>saveClick: function() {
    var json = JSON.stringify(this.data);
    // assume json matches the JSON provided above.
    // Now, I'm not sure how to actually save the file.
  } 
  </code></pre>
  
  <p>So, how / where do I save JSON to the local file system for use at a later time?</p>