1 const regex = /}}/ig
2 const commaEndOfObjects = response.data.replace(regex, '}},');
3 const lastCommaToRemove = commaEndOfObjects.lastIndexOf('}},') + 2
4 const removeLastComma = commaEndOfObjects.slice(0, lastCommaToRemove) + commaEndOfObjects.slice(lastCommaToRemove +1);
5 const onlySingleQuotes = removeLastComma.replace(/'/g, '"');
6 const insideArray = `[${onlySingleQuotes}]`
7 const result = JSON.parse(insideArray)