I have a question about storing data in strings. For example:
var xyz = '{ Product : ['
xyz = xyz + { id:"1",name:"abc"} //this is generated via a loop
xyz = xyz + ']}';
$scope.data = JSON.parse(xyz);
However, I am encountering an error. It seems to be appending "" to my string and formatting it like this:
JSON.parse("{ Product : [{ id:"1",name:"abc"}]}")
Any suggestions on how to resolve this issue? Thank you in advance.