Transform an object in JavaScript
<p>I have an object with structure of:</p>

<pre><code>[ {"vid":"aaa", "san":12}, 
  {"vid":"aaa", "san":18}, 
  {"vid":"aaa", "san":2}, 
  {"vid":"bbb", "san":33}, 
  {"vid":"bbb", "san":44}, 
  {"vid":"aaa", "san":100}]
</code></pre>

<p>This object is passed to function called <code>SerializeData(inData)</code> as <code>inData</code> variable:</p>

<pre><code>function SerializeResults( inData ) {
    $.each( inData, function( i, val ) {
    });
} 
</code></pre>

<p>I want to iterate all objects in <code>inData</code> and transform it, so in result I get an object with structure like this:</p>

<pre><code>[ { "vid":"aaa","san":[12,18,2,100] }, 
  { "vid":"bbb","san":[33,44] } ]
</code></pre>

<p>How do I do that?</p>
