I would like to convert a field name consisting of square brackets into an object in JavaScript. I have seen that PHP does convert them into an array but haven't seen one done in JavaScript despite of searching for one for several days.
Data:
<input name="address[permanent][name]" type="text" value="My Address">
<input name="address[permanent][street][street_one]" type="text" value="My Street One">
<input name="address[permanent][street][street_two]" type="text" value="My Street Two">
Result (what i want to achieve):
form = { address: { permanent: { name: "My Address", street: { street_one: "My Street One", street_two: "My Street Two" } } } }