text input have names with arrays styles (name="post[2][id]"). I need get this values in jQuery script with this structure names. So that I can work as a normal array.
$(document).ready(function(){   
    var data = {};
    data['post'] = {};
    var fields = $("#user input");
    $.each(fields, function(index, field) {
        data[$(field).attr('name')] = $(field).val();
    });
    console.log(data);
});
<div id="user">
    <input type="text" name="name" value="Joy" />
    <input type="text" name="post[1][id]" value="2" />
    <input type="text" name="post[1][name]" value="test" />
    <input type="text" name="post[2][id]" value="3" />
    <input type="text" name="post[2][name]" value="test 2" />
</div>
Now my name add like string in data variable, so this is very bad. I need this:
alert(data.post.1.id) // 2