How do I turn a string that resembles an array into an actual array? This thread advised that I should use JSON.parse -- Convert string into Array in rails, but when I go to try that, I get an error
localhost:nightminer satishp$ rails console
Running via Spring preloader in process 9674
Loading development environment (Rails 5.0.6)
irb(main):001:0> JSON.parse("['2de33']")
JSON::ParserError: 409: unexpected token at ''2de33']'
from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4./json/common.rb:156:in `parse'
from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4./json/common.rb:156:in `parse'
from (irb):1
Any advice on how to get my array of strings is appreciated. Note I can't change the input (I can't remove the single quotes).
JSON.parseis the right tool for the job.