JSFiddle - React, Tailwind, and code Playground
by Marcel
HTML
<form id ="myform">
<input type="text" name="options[]" value="value 1" />
<input type="text" name="options[]" value="value 2" />
<input type="text" name="options[]" value="value 3" />
<input type="text" name="options[]" value="value 4" />
</form>
JavaScript
var arr = $("#myform").serializeArray();
var result = {"objects":{}};
arr.forEach(function (elem, i) {
result.objects[i] = elem["value"];
});
console.log(JSON.stringify(result));