title: Defining JSON dynamically - can't find what I am doing wrong
body: <p>I am trying to put form content in a JSON dynamically.
  It worked before, but after I added a extra layer (arrays in arrays) there seem to be something that I am doing wrong:</p>
  
  <pre><code>aJSON = {};
  aJSON['properties'] = [];
  aJSON['options'] = [];
  aJSON['arrays'] = [];
  $('input').each(function () {
      if($(this).attr('name') != undefined) {
          if($(this).attr('name').indexOf('[]') &gt; -1) {
              if(aJSON['arrays'][$(this).attr('name')] == undefined) {
                  aJSON['arrays'][$(this).attr('name')] = [];
              }
              if($(this).is(':checked')) {
                  aJSON['arrays'][$(this).attr('name')][$(this).attr('value')] = 1;
              } else {
                  aJSON['arrays'][$(this).attr('name')][$(this).attr('value')] = 0;
              }
          } else {
              aJSON['properties'][$(this).attr('name')] = $(this).val();
          }
      }
  });
  
  $('select').each(function () {
      if($(this).attr('name') != undefined) {
          aJSON['properties'][$(this).attr('name')] = $(this).val();
      }
  });
  var array = getUrlVars();
  aJSON['options']['type'] = array['type'];
  aJSON['options']['id'] = array['id'];
  aJSON['options']['view'] = pageSpecificVariables['view'];
  </code></pre>
  
  <p>The top 4 lines are just a tryout, I also tried:</p>
  
  <pre><code>aJSON = {'properties':[], 'options':[], 'arrays':[]}
  </code></pre>
  
  <p>But the only result I am getting is an object with empty arrays of properties, options and arrays.</p>
  
  <p>Before I put all the values directly in aJSON and that worked perfectly.
  But for categorizing, I need the 3 categories to exist.</p>
  
  <p>Any idea why my values aren't written to the aJSON?</p>
  
  <h2>EDIT</h2>
  
  <p>Added JSfiddle here: <a href="http://jsfiddle.net/abayob/pob32fs1/" rel="nofollow">http://jsfiddle.net/abayob/pob32fs1/</a></p>