Closed Tyxiang closed 3 years ago
Seems like a bug. In the meantime, you can mitigate this by using an explicit index, and the option useIntKeysAsArrayIndex: true
.
The form:
<form>
<input type="text" name="peoples[0][name][first]:string" value="Liu" />
<input type="text" name="peoples[0][name][last]:string" value="Tom" />
<input type="text" name="peoples[0][age]:string" value="12" />
<input type="text" name="peoples[1][name][first]:string" value="Gao" />
<input type="text" name="peoples[1][name][last]:string" value="Jack" />
<input type="text" name="peoples[1][age]:string" value="15" />
</form>
JavaScript call:
$('form').serializeJSON({useIntKeysAsArrayIndex: true});
the form
desired result
actual result