Prashant Ravi Darshan Prashant Ravi Darshan - 11 months ago 80
Ruby Question

Extract array in string rails

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.

Answer Source

Just parse it with JSON.parse method like this ;

JSON.parse("[1,2,3]")