jquery creating two dimensional array

You can't create a two dimensional array in Javascript, arrays can only have one dimension. Jagged arrays, i.e. arrays of arrays, are used instead of two dimensional arrays.

Example:

var a = [
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
];

The desired format that you show is neither a two dimensional array nor a jagged array, instead it's an object containing a property that is an array of objects. However, the object in the array has two properties with the same name, so I assume, you meant that as having two objects in the array:

var o = {
  product: [
    { attribute: "value" },
    { attribute: "value" }
  ]
};

You can create an object like that using a literal object like above, or you can create it by adding properties and array items afterwards:

var o = {};
o.product = [];
o.product.push({ attribute: "value" });
o.product.push({ attribute: "value" });

That's not a 2D array, but rather an object. Also, your product array contains only one object. I think you need something like this:

var obj = {};
obj.product = [];
for(var i=0; i < someObj.length; i++) {
   obj.product.push[{"attribute": someObj[i]}]
}

This will produce an array inside the product property:

{"product":[{"attribute":"value"}, {"attribute":"value"}]}