title: create JSON object from another JSON object
body: <p>I don't know if the title is the right one for what I want to do.</p>
  
  <p>I have the following array of objects</p>
  
  <pre><code>    array([0]: {category: "10",
                  question: "101"},
            [1]: {category: "10",
                  question: "102"},
            [2]: {category: "20",
                  question: "201"}
      );
  </code></pre>
  
  <p>And I want to group all the elements into something like this:</p>
  
  <pre><code>    array([0]: {category: "10", {question: "101",
                                   question: "102"}},
                  category: "20", {question: "201"}});
  </code></pre>
  
  <p>I don't know if this is possible or if there's another better way to solve this problem (maybe with a two-dimensional array?) but any help would be very appreciated.</p>
  
  <p>Thanks!</p>
  
  <p>Sorry for the lack of information, here is how I create my array of objects:</p>
  
  <pre><code>    var arr_sections = [];
      var arr_questions = [];
  var jsonObj = [];
  $('.ui-sortable-nostyle').each(function(){
      arr_sections.push($(this).attr("sec_id"));              
  });
  
  // create json object with pairs category - question 
  $(".sortable2").each(function(i){                           
      $(this).children().each(function(j){    
          var cat = arr_sections[i];
          jsonObj.push({
              category: arr_sections[i],
              question: $(this).attr("ques_id")
          });     
      });
  });  
  </code></pre>
  
  <p>And got an array of objects with the following structure:</p>
  
  <pre><code>    [Object, Object, Object, Object, Object]
      0: Object
         category: "1052"
         question: "3701"
         __proto__: Object 
      1: Object
         category: "1053"
         question: "3702"
         __proto__: Object
      2: Object
         category: "483"
         question: "1550"
         __proto__: Object
      3: Object
         category: "483"
         question: "1548"
         __proto__: Object
      4: Object
         category: "483"
         question: "1549"
         __proto__: Object
      length: 5
  </code></pre>
  
  <p>Tried to create my new array:</p>
  
  <pre><code>    for(var i = 0; i &lt; jsonObj.length; i++){
          temp[jsonObj[i].category] = jsonObj[i].question;
  }
  </code></pre>
  
  <p>But I don't get all values:</p>
  
  <pre><code>    [483: "1549", 1052: "3701", 1053: "3702"] 
  </code></pre>