JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div class="form-group">
<input name="MyAttributes[1].Key" />
<input name="MyAttributes[1].Value" />
</div>
<div class="form-group">
<input name="MyAttributes[2].Key" />
<input name="MyAttributes[2].Value" />
</div>
</div>
JavaScript
$("#container > .form-group").each(function(i, el) {
$("input", el).attr("name", function(j, name) {
return name.replace(/\[\d*\]/, "[" + i + "]");
});
});