My string is
"[1,2,3]"
I want to get output in the below format
[1,2,3]
I want to extract array present in my string.
Just parse it with JSON.parse method like this ;
JSON.parse("[1,2,3]")
You can use eval:
try:
eval("[1,2,3]")
=> [1, 2, 3]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With