ok, so I have an object like:
var myobject = {
\"field_1\": \"lorem ipsum\",
\"field_2\": 1,
\"field_2\": 2,
\"field_2\": 6
};
That is not an array that is an object. You'd be better creating a property of the object that is an array and store the different values in there.
var myarray = {
"field_1": "lorem ipsum",
"field_array": []
};
myarray.field_array.push(value);
then just loop through that property of the array.
Test
var obj = {
"field_1": "lorem ipsum",
"field_2": 1,
"field_2": 2,
"field_2": 6
};
for ( var i in obj ) {
console.log(i + " = " + obj[i]);
}
OUTPUT
field_1 = lorem ipsum
field_2 = 6