How to convert PostgreSQL Array in string eg. "{1,2,3,4}" to javascript/typescript array: [1,2,3,4].
The values in the array must be a number type.
I tried a solution with replace and split but it returns string values.
var test = "{1,2,3,4}";
test = test.replace("{", "");
test = test.replace("}", "");
//test = test.replace(/\{|\}/gm, "") //regex replace
test.split(",") //['1', '2', '3', '4']
JSON.parse(test.replace("{", "[").replace("}", "]"))