title: Javascript Create JSON Hash Array for jQuery AJAX
body: <p>I am desperately trying to manually create a JSON-style array in Javascript to send over the network via jQuery's AJAX method.</p>
  
  <pre><code>var fieldsobj = {fields:[]}
  $(".fact_field", fact).each(function(index, field){
      var index  = $(field).attr("data-index");
      var name  = $(".fact_field_label", field).text().trim();
      var value  = $(".fact_field_value", field).text().trim();
      fieldsobj["fields"].push({index:index, name:name, value:value});
  });
  //...
  $.ajax({
      type: 'PUT',
      url: url,
      data: fieldsobj,
      success: function(data){...
      },
      complete: function(){...
      }
  });
  </code></pre>
  
  <p>What I want is the following:</p>
  
  <pre><code>{fields =&gt; [{index:0, name:1, value:2},{...},{...}]}
  </code></pre>
  
  <p>What I get is this:</p>
  
  <pre><code> {"fields"=&gt;{"0"=&gt;{...}, "1"=&gt;{..}, "2"=&gt;{...}, "3"=&gt;{...}}
  </code></pre>
  
  <p>What am I doing wrong?</p>