I have this array object
var customers = [{
"id": "1",
"name": "1",
"position": "1",
"office": "<button data-id=2 class='btn btn-danger'><i class='fa fa-trash fa-lg'></i> Delete record</button>",
"active": "1"
}, {
"id": "2",
"name": "2",
"position": "2",
"office": "<button data-id=2 class='btn btn-danger'><i class='fa fa-trash fa-lg'></i> Delete record</button>",
"active": 0
}];
What i need is to make a new array that will only have active customers, that new array will look like
var activeCustomers = [{
"id": "1",
"name": "1",
"position": "1",
"office": "1",
"active":"1"
}
}];
Because you may see there is only one active customer?
activeCustomersvariable you have is not valid JSON. There's an extra end-brace. Also, do you wantofficeto be 1? It seems like you would want theofficeto retain the same value since you never mentioned otherwise.activeCustomersis not valid.