title: How do I update the data saved in a JSON file using JavaScript?
body: <p>How do I update the data saved in a JSON file using JavaScript?</p>
  <p>for example: If i have a JSON file called 'person.json', looking like:</p>
  <pre><code>{
    &quot;Person&quot;: [
      {
        &quot;Firstname&quot;: &quot;John&quot;,
        &quot;Lastname&quot;: &quot;Doe&quot;
      }
    ]
  }
  </code></pre>
  <p>and I would like to append as new data set the name 'John Smith'.
  How could I do this using JavaScript?</p>
  <p>EDIT:
  Now I tried to use 'fs.readFile()' to read my JSON file.
  The application I develop is a hybrid app using cordova.
  If i use 'fs.readFile()' i get the error 'Uncaught ReferenceError: fs is not defined'.
  I tried to fix this problem by adding the line 'var fs = Npm.require('fs');'.
  But this causes also an error: 'Uncaught ReferenceError: Npm is not defined'</p>
  <p>Is this error caused because npm is not available on a smartphone?
  And how can i fix this problem?</p>