Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have a type String that looks like '["123", 123, "testing"]'.
String
'["123", 123, "testing"]'
How do I change that String into type Array?
Array
JSON.parse('["123", 123, "testing"]')
JSON.parse
You can use JSON.parse. See example below:
var str = '["123", 123, "testing"]'; var strArray = JSON.parse(str); console.log(strArray); for(var i = 0; i < strArray.length; i++) { console.log(strArray[i]); }
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
JSON.parse('["123", 123, "testing"]')JSON.parseit. However, your nearly-identical previous question showed the array in a different format...