$scope.partsLinesTest = data[0].instock; // this is getting the JSOn data
from my http request
for(var i=0; $scope.partsLinesTest.length > 0; i++) {
//$scope.partsLinesTest = $scope.partsLinesTest[0].instock;
console.log($scope.partsLinesTest.replace(/['{[\]}']/g,''))
var str = $scope.partsLinesTest;
$scope.partsLinesStock = str.replace(/['{[\]}']/g,'');
}
The Json data is somewhat formatted as below, my problem is with instock due to the extra regular brackets and curly braces which is why I thought using RegEX would solve problem, however I can't seem to iterate correctly through the data and post it back into the view, also I'm using Angular
var test = [
{
"id": 1,
"title": "This is a document",
"desc": "PO",
"date": "2017-01-15",
"instock": "[{'branch': 'Edmonton', 'quantity': 2}]"
}