title: How to put all form's data into JSON on javascript?
body: <p>I have the next form:</p>
  
  <pre><code>&lt;form id="form"&gt;
  &lt;input type="checkbox" name="numbers" value="1"&gt;
  &lt;select name="ordering[numbers]"&gt;
      &lt;option value="ASC"&gt;Ascend&lt;/option&gt;
      &lt;option value="DESC"&gt;Descend&lt;/option&gt;
  &lt;/select&gt;&lt;br&gt;
  &lt;input type="checkbox" name="added_date" value="1"&gt; Call date 
  &lt;select name="ordering[added_date]"&gt;
      &lt;option value="ASC"&gt;Ascend&lt;/option&gt;
      &lt;option value="DESC"&gt;Descend&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Basically I need to save all data to JSON object before submitting form, let's call it form_json
  I'm using jQuery.serializeArray() function </p>
  
  <pre><code>var form_json = $("#form").serializeArray();
  </code></pre>
  
  <p>I get the next object if both of checkboxes are checked:</p>
  
  <pre><code>[
      {"name": "numbers", "value": "1"},
      {"name": "ordering[numbers]", "value": "ASC"},
      {"name": "added_date","value":"1"},
      {"name": "ordering[added_date]", "value": "ASC"}
  ]
  </code></pre>
  
  <p>Which is not what I was expected. 
  I want to have the next format somehow:</p>
  
  <pre><code>[
      {"name": "numbers","value": "1"},
      {"name": "added_date","value": "1"},
      {"name": "ordering", "value": {
              "numbers": "ASC",
              "added_date": "ASC"}
      }  
  ]
  </code></pre>
  
  <p>Is that possible to do that? 
  Thanks!</p>