Answers for "convert ruby hash to javascript object"

2

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('=>', ':')
Posted by: Guest on September-10-2021

Code answers related to "convert ruby hash to javascript object"

Browse Popular Code Answers by Language