title: Illustrator Script: Generate a JSON file
body: <p>I have been working on creating a system where I can export my swatches from Illustrator as a JSON object in order to allow for my simplicity when trying to update my App that I have created. </p>
  
  <p>Using the illustrator scripting API I have managed to loop through all my swatches and generate an object. What I am attempting to do now is take this data and generate a JSON file with it. This is so that whenever I make colour updates to my App in illustrator it will immediately change everything when I run that script. </p>
  
  <p>I have been making use of <a href="http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2015_3/Illustrator%20JavaScript%20Scripting%20Reference.pdf" rel="nofollow">Adobe Documentation</a> as well as a helpful site with it simplified and easier to navigate <a href="http://jongware.mit.edu/iljscs6html/iljscs6/pc_Document.html#saveAs" rel="nofollow">Jongware</a>.</p>
  
  <p>The code overall looks like this: <a href="https://jsfiddle.net/86tqs33c/" rel="nofollow">JSFiddle</a></p>
  
  <p>The code in question is the following. I am not sure if there is  way to generate the file without making use of the API. They seem to be using the same JS engine as a browser would but I am not 100% sure. Any advice would be great!</p>
  
  <pre><code>var file = new File('filename.txt');
  file.saveAs('txt');
  </code></pre>
  
  <p>So the main question is how would I generate a new file locally that is able to store this object I have created? As the API isnt that clear on how to create a basic text file from the data I have created.</p>