title: Associative arrays in javascript to JSON
body: <p>I am using array as an associative array of objects in which keys are ID number of objects in database. Quiet naturally- IDs are large numbers - so that means it is common to have array of length 10^4 with only 20 elements as valid real objects. </p>
  
  <p>I want to send this data back to server but whatever plugins I had to convert js objects to JSON- I tried them all &amp; they all produce a JSON string of length 10^4. So much data can't be sent back.</p>
  
  <p>I need a way of converting associative array to JSON discarding undefined entries.<br>
  Any suggestions ?</p>
  
  <p><strong>EDIT:</strong>
  Example of what my array looks like :
  var myAssociativeArray = [undefined, undefined,undefined...., someobject, some other object ...,undefined, ... yet another....]</p>