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]    
     }); 
 }

```
This isn't an AngularJS question at all; we can solve it with simple JavaScript. Assuming you have an array of customers and an object template, you can simply iterate over the array and map each one to an object:

```js
const customers = [ '123', '456' ];
const template = {
  branchAssociated: {
    isGridBranch: false,
  },
};

const mappedCustomers = customers.map( customer => {
  const obj = angular.copy( template );
  template.customerNumber = customer;

  return obj;
});

const json = JSON.stringify( mappedCustomers );

```