var serialize = function(data, name) {
  var product = [];
  for(var property in data) {
    if (data.hasOwnProperty(property)) {
        var key = property;
        if(name){
            key = name + '[' + property + ']';
        }
        var value = data[property];
        var string = (value && typeof value == 'object')
            ? serialize(value, key)
            : encodeURIComponent(key) + '=' + encodeURIComponent(value);
        product.push(string);
    }
  }
  return product.join('&');
}

POC: http://jsfiddle.net/moagrius/vftL6fvh/