var group_fields = [];
// Loop through the fields
theForm.serializeArray().forEach(function(entry,i) {
// Get the index and prop name from the entry name
var nameparts = /^([a-zA-Z0-9_]+)\[(.+)\]\[(.*)\]$/.exec(entry.name);
// Get the group entry if we already have it
var group = group_fields[nameparts[2]];
if (!group) {
// We don't, create and add it
group = group_fields[nameparts[2]] = {};
}
// Set the property (address, street, etc.)
group_fields[nameparts[2]][nameparts[3]] = entry.value;
});