title: jquery serialize input with arrays
body: <p>I have a form on my site like this:</p>
  
  <pre><code>&lt;form id="myform" action="" method=""&gt;
   &lt;input type="text" name="name[1][first]"&gt;
   &lt;input type="text" name="name[2][first]"&gt;
   &lt;input type="text" name="name[3][first]"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I want to simply grab all the data and send it to a webservice so have this js:</p>
  
  <pre><code>$fields = $('#myform').serializeArray();
  </code></pre>
  
  <p>Problem is, it creates the json with all the brackets shown in the input names so I get a parse error.</p>
  
  <p>How can I use serializeArray and get proper json?</p>
  
  <p>The resulting format that I would like to see is something like this:</p>
  
  <pre><code>{
    "name": {
      "1": {
        "first": "val1"
      },
      "2": {
        "first": "val2"
      },
      "3": {
        "first": "val3"
      }
    }
  }
  </code></pre>
  
  <p>Thanks!</p>