For example: '[test,abc,123]'. How do you turn that into a standard javascript array that can be iterated?
Asked
Active
Viewed 60 times
-1
-
2That's not a stringified array. Fix whatever's giving you that essentially broken input so that it gives you JSON instead, then parse the JSON – CertainPerformance Feb 22 '20 at 03:22
1 Answers
0
This will work, but really you should fix your input to give you real JSON as is noted in the comments.
console.log(JSON.parse('["test","abc",123]'));

Jonathan Rys
- 1,782
- 1
- 13
- 25