将字符串化数组解析为数组

Parsing a stringified array to an array

我有一个组件在后端抛出以下内容

memberSince: [ '["2022-05-05T08:13:07.551Z","2022-06-01T08:13:07.551Z"]' ]

有没有办法取消数组内容的字符串化,比如 memberSince[0].parse() 之类的

您可以使用JSON.parse()

const data = {memberSince: ['["2022-05-05T08:13:07.551Z","2022-06-01T08:13:07.551Z"]']}

const result = JSON.parse(data.memberSince)

console.log(result)