const str = '[{id:1,latitudes:"23.114285", longitude:"114.416599", name:hugo }]'
const jsonStr = str.replace(
/"?((?:(?!\{).)+?)"?:"?((?:(?![\}|,|"]).)*)"?([,|\}])/g,
(_, b, c, d) => {
return `"${b.trim()}":"${c.trim()}"${d}`
},
)
const arr = JSON.parse(jsonStr)
js字符串数组类型的转正常类型数组
最新推荐文章于 2022-09-22 14:01:18 发布