📜  mixpanel api 数据解析 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:38.931000             🧑  作者: Mango

代码示例1
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)