Dynamic Array Values Convert into Array of Object in JavaScript
<input type="text" name="header_key[]" class="form-control m-input" placeholder="Key" autocomplete="off">
<input type="text" name="header_val[]" class="form-control m-input" placeholder="Value" autocomplete="off">
var obj_headers={}
var header_key = $("input[name='header_key[]']").map(function(){
return $(this).val();
}).get();
var header_val = $("input[name='header_val[]']").map(function(){
return $(this).val();
}).get();
for (var i = 0; i < header_key.length; i++) {
debugger;
obj_headers[header_key[i]] = header_val[i];
}