Can you help me understand how to transform a string into an array of objects?
let str = `<%-found%>`;
let result = [];
JSON.parse(`["${str}"]`.replace(/},{/g, `}","{`)).forEach((e) => {
result.push(JSON.parse(e.replace(/{/g, `{"`).replace(/:/g, `":`).replace(/,/g, `,"`)));
});
`<%-found%>` = "{SPOT:0,0:10,1:0},{SPOT:1,0:5,1:5}"
There seems to be an error:
Uncaught SyntaxError: Unexpected token in JSON at position 3 at JSON.parse () at (index):2010