【发布时间】:2021-12-20 17:57:42
【问题描述】:
我在 StackOverflow 上研究了几个问题,但找不到相关答案。
我有一个像这样的数组字符串:
"[{"insert":"Test"},{"insert":"\n","attributes":{"header":1}},{"insert":"Asdasfff"},{"insert":"\n","attributes":{"list":"bullet"}},{"insert":"Asadsf"},{"insert":"\n","attributes":{"list":"bullet"}},{"insert":"Sfsfsft"},{"insert":"\n","attributes":{"header":2}},{"insert":"Make"},{"insert":"\n","attributes":{"list":"unchecked"}},{"insert":"Back"},{"insert":"\n","attributes":{"list":"checked"}},{"insert":"Ban"},{"insert":"\n","attributes":{"list":"unchecked"}},{"insert":"Fg"},{"insert":"\n","attributes":{"list":"checked"}}]"
我需要将其转换为如下所示的数组:
我试过JSON.parse(),但没用!
【问题讨论】:
标签: arrays reactjs json string javascript-objects