title: return json from javascript function issue
body: <p>i am tring to return custom json object from javascript function my code is as below </p>
  
  <p><strong><a href="http://jsfiddle.net/pintu31/BePSK/1/" rel="noreferrer">Fiddle</a></strong> </p>
  
  <p><strong>html</strong>  </p>
  
  <pre><code>&lt;input type='checkbox' name='chk[]' value='1'&gt;1
  &lt;input type='checkbox' name='chk[]' value='2'&gt;2
  &lt;input type='text' id='txt' value='' /&gt;
  &lt;input id='btn' type='button' value='click' /&gt;​
  </code></pre>
  
  <p><strong>js</strong></p>
  
  <pre><code>var json = {};
  
  $('#btn').click(function(){
    console.log(getdata());
  });
  function getdata(){
    $('input:checked').each(function(i){
        json.chk = $(this).val();
        //json.chk.push({"val": $(this).val()}); gives error Uncaught TypeError: Cannot call method 'push' of undefined
    });
  
    json.txt = document.getElementById("txt").value;
  
   return json;
  }
  </code></pre>
  
  <p>​
  i need result like below </p>
  
  <pre><code>{
    chk: [{val: 1}, {val: 2}],
    txt: 'test'
  };
  </code></pre>