title: storing form data into a json file
body: <p>I have created a form in html and I want to store its data inserted by the user in a JSON file in the form of json objects &amp; arrays, I am new with json &amp; javascript so kindly tell how can I do this?</p>
  
  <p><strong>this is my html form:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;form&gt;
      First name:&lt;input type="text" name="firstname"&gt;Last name:&lt;input type="text" name="lastname"&gt;&lt;br&gt;
      Gender: &lt;input type="radio" name="gender"&gt;male&lt;input type="radio" name="gender"&gt;female&lt;br&gt;
      Married: &lt;input type="checkbox" name="married"&gt;yes&lt;input type="checkbox" name="merried"&gt;no&lt;br&gt;
      Degree:
      &lt;select&gt;
          &lt;option&gt;BS&lt;/option&gt;
          &lt;option&gt;MS&lt;/option&gt;
          &lt;option&gt;PhD&lt;/option&gt;
      &lt;/select&gt;
      Description: &lt;textarea style="width:200px"&gt;&lt;/textarea&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>and I want the output <em>.json</em> file like this:</strong></p>
  
  <pre><code>[
      {
          "first name": "adam",
          "last name": "smith"
          "gender": "male",
          "merried": "yes"
          "degree": "MS",
          "description": "any discription"
  
      },
      {
          "first name": "anglina",
          "last name": "jouley"
          "gender": "female",
          "merried": "no"
          "degree": "PhD",
          "description": "any discription"
      },
  ]
  </code></pre>