Tengo varios elementos HTML en los cuales obtengo los valores usando JQuery y array:
var trads = $("select[name='personal[]']").map(function(){return $(this).val();}).get();
var num_trad = trads.length;
var langs = new Array();
var values = new Array();
var approved = new Array();
for (var i=1; i<=num_trad; i++){
langs.push($("select[name='lang_"+i+"[]']").map(function(){return $(this).val();}).get());
values.push($("input[name='words_"+i+"[]'").map(function(){return $(this).val();}).get());
values.push($("input[name='approved_"+i+"[]'").map(function(){return $(this).val();}).get());
}
console.log(trads);
console.log(langs);
console.log(values);
.divs{float:left;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<select name="personal[]">
<option value="1001">Mark</option>
<option value="1002">Rose</option>
</select>
<div style="clear:both;">
<div class="divs">
<select name="lang_1[]">
<option value="English">English</option>
<option value="Spanish">Spanish</option>
</select>
</div>
<div class="divs">
<input name="words_1[]" value="302">
<input name="approved_1[]" value="yes">
</div>
</div>
<div style="clear:both;">
<div class="divs">
<select name="lang_1[]">
<option value="English">English</option>
<option value="Spanish" selected>Spanish</option>
</select>
</div>
<div class="divs">
<input name="words_1[]" value="180">
<input name="approved_1[]" value="no">
</div>
</div>
<hr style="clear: both;">
<select name="personal[]">
<option value="1001">Mark</option>
<option value="1002" selected>Rose</option>
</select>
<div style="clear:both;">
<div class="divs">
<select name="lang_2[]">
<option value="English">English</option>
<option value="Spanish" selected>Spanish</option>
</select>
</div>
<div class="divs">
<input name="words_2[]" value="236">
<input name="approved_2[]" value="yes">
</div>
</div>
<hr style="clear: both;">
Como se muestra en el resultado se muestra de manera separada y me gustaría ordenar estos valores como un JSON string obteniendo algo similar como esto:
"1001":{ content:[{ language: "English", words: "302", approved: "yes" }, { language: "Spanish", words: "180", approved: "no" }] }, "1002":{ content:[{ language: "Spanish", words: "236", approved: "yes" }] }
¿Cómo puedo lograrlo?
Agradeceré su ayuda.