marioizquierdo / jquery.serializeJSON

Serialize an HTML Form to a JavaScript Object, supporting nested attributes and arrays.
MIT License
1.71k stars 433 forks source link

Improve serialization of unindexed arrays with nested objects #111

Closed marioizquierdo closed 3 years ago

marioizquierdo commented 3 years ago

Fixes #110

When using the arr[] syntax to add more elements to the same array, and using nested keys arr[][nestedObjAttr] with multiple nested objects arr[][nestedObjAttr][secondNestedAttr], it was erroneously overriding the nested key. The function deepSet will now check nested keys to see if the previous value was already set or not in nested objects.