Question: I have the JSON object and i want to push the array values in to an JSON.

```
      $scope.customerObjArray = ['34343434','73473333434'];

        $scope.jointUsersObj = {
            "branchAssociated": {
               "isGridBranch": false
            },             
            "customerNumber": ""              
        };

     for(var i = 0; i < $scope.customerObjArray.length; i++){
         $scope.jointUsersObj.customerNumber = $scope.customerObjArray[i];                
     }

```

I want the output in the following way,

```
{
   "branchAssociated": {
     "isGridBranch": false
    },             
    "customerNumber": "34343434"              
},
{  
   "branchAssociated": {
       "isGridBranch": false
    },             
    "customerNumber": "73473333434"              
}

```

Answer: 
Well, you are doing this: 

foreach number `n` in `$scope.customerObjArray`, update the property `customerNumber` of `$scope.jointUsersObj` to be `n`

What you actually want to do is: 

foreach number `n` in `$scope.customerObjArray`, make a copy of `$scope.jointUsersObj` with property `customerNumber` to be `n`

try this:

```
$scope.jointUserObjects = [] // this is an array of users
for(var i = 0; i < $scope.customerObjArray.length; i++) {
     $scope.jointUserObjects.push({
        branchAssociated: {
              isGridBranch: false
        },             
        customerNumber: $scope.customerObjArray[i]    
     }); 
 }

```
Just declare an array and push the objects to that array.

```
$scope.customerObjArray = ['34343434', '73473333434'];

$scope.jointUsersObj = {
    "branchAssociated": {
        "isGridBranch": false
    },
    "customerNumber": ""
};
var jointUsersArray = [];
for (var i = 0; i < $scope.customerObjArray.length; i++) {
    $scope.jointUsersObj.customerNumber = $scope.customerObjArray[i];
    jointUsersArray.push($scope.jointUsersObj);
}

```