Answers for "mixpanel api data parsing"

1

mixpanel api data parsing

const regex = /}}/ig
      const commaEndOfObjects = response.data.replace(regex, '}},');
      const lastCommaToRemove = commaEndOfObjects.lastIndexOf('}},') + 2
      const removeLastComma = commaEndOfObjects.slice(0, lastCommaToRemove) + commaEndOfObjects.slice(lastCommaToRemove +1);
      const onlySingleQuotes = removeLastComma.replace(/'/g, '"');
      const insideArray = `[${onlySingleQuotes}]`
      const result = JSON.parse(insideArray)
Posted by: Guest on February-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language