Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

convert string to hash ruby

hash_as_string = 
	"{"0"=>{"answer"=>"1", "value"=>"No"}, 
    "1"=>{"answer"=>"2", "value"=>"Yes"}, 
    "2"=>{"answer"=>"3", "value"=>"No"}, 
    "3"=>{"answer"=>"4", "value"=>"1"}, 
    "4"=>{"value"=>"2"}, "5"=>{"value"=>"3"}, 
    "6"=>{"value"=>"4"}}"
JSON.parse hash_as_string.gsub('=>', ':')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #string #hash #ruby
ADD COMMENT
Topic
Name
5+8 =